From d1a35a4d58920f626c5cae29d074b737e34827e5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 18 May 2021 12:36:46 -0500 Subject: [PATCH] Allow direct creation of new label batches now technically this is allowed on desktop, but probably makes more sense on mobile via api --- tailbone/api/batch/labels.py | 4 +++- tailbone/views/batch/labels.py | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tailbone/api/batch/labels.py b/tailbone/api/batch/labels.py index 0648a0c9..11a3d20d 100644 --- a/tailbone/api/batch/labels.py +++ b/tailbone/api/batch/labels.py @@ -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 diff --git a/tailbone/views/batch/labels.py b/tailbone/views/batch/labels.py index 5015ffdc..c52a5a67 100644 --- a/tailbone/views/batch/labels.py +++ b/tailbone/views/batch/labels.py @@ -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: