Allow direct creation of new label batches

now technically this is allowed on desktop, but probably makes more
sense on mobile via api
This commit is contained in:
Lance Edgar 2021-05-18 12:36:46 -05:00
parent 949b9d64bf
commit d1a35a4d58
2 changed files with 9 additions and 5 deletions

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2020 Lance Edgar # Copyright © 2010-2021 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -61,7 +61,9 @@ class LabelBatchRowViews(APIBatchRowView):
data['item_id'] = row.item_id data['item_id'] = row.item_id
data['upc'] = six.text_type(row.upc) data['upc'] = six.text_type(row.upc)
data['upc_pretty'] = row.upc.pretty() if row.upc else None data['upc_pretty'] = row.upc.pretty() if row.upc else None
data['brand_name'] = row.brand_name
data['description'] = row.description data['description'] = row.description
data['size'] = row.size
data['full_description'] = row.product.full_description if row.product else row.description data['full_description'] = row.product.full_description if row.product else row.description
return data return data

View file

@ -48,7 +48,6 @@ class LabelBatchView(BatchMasterView):
route_prefix = 'labels.batch' route_prefix = 'labels.batch'
url_prefix = '/labels/batches' url_prefix = '/labels/batches'
template_prefix = '/batch/labels' template_prefix = '/batch/labels'
creatable = False
bulk_deletable = True bulk_deletable = True
rows_editable = True rows_editable = True
rows_bulk_deletable = True rows_bulk_deletable = True
@ -116,12 +115,15 @@ class LabelBatchView(BatchMasterView):
super(LabelBatchView, self).configure_form(f) super(LabelBatchView, self).configure_form(f)
# handheld_batches # handheld_batches
f.set_readonly('handheld_batches') if self.creating:
f.set_renderer('handheld_batches', self.render_handheld_batches) f.remove('handheld_batches')
if self.viewing or self.deleting: else:
batch = self.get_instance() batch = self.get_instance()
if not batch._handhelds: if not batch._handhelds:
f.remove_field('handheld_batches') f.remove_field('handheld_batches')
else:
f.set_readonly('handheld_batches')
f.set_renderer('handheld_batches', self.render_handheld_batches)
# label profile # label profile
if self.creating or self.editing: if self.creating or self.editing: