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

View file

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