diff --git a/tailbone/templates/batch/inventory/desktop_form.mako b/tailbone/templates/batch/inventory/desktop_form.mako index 77d573dd..22ca68d7 100644 --- a/tailbone/templates/batch/inventory/desktop_form.mako +++ b/tailbone/templates/batch/inventory/desktop_form.mako @@ -114,6 +114,10 @@ $('#size').val(data.product.size); $('#case_quantity').val(data.product.case_quantity); + if (data.force_unit_item) { + $('#product-info .warning.force-unit').show(); + } + if (data.already_present_in_batch) { $('#product-info .warning.present').show(); $('#cases').val(data.cases); @@ -248,6 +252,7 @@
please confirm UPC and provide more details
product already exists in batch, please confirm count
+
pack item scanned, but must count units instead
diff --git a/tailbone/views/inventory.py b/tailbone/views/inventory.py index eb1105f5..18312e56 100644 --- a/tailbone/views/inventory.py +++ b/tailbone/views/inventory.py @@ -380,6 +380,12 @@ class InventoryBatchView(BatchMasterView): else: product = self.find_product(entry) + force_unit_item = True # TODO: make configurable? + unit_forced = False + if force_unit_item and product.is_pack_item(): + product = product.unit + unit_forced = True + data = self.product_info(product) if type2: data['type2'] = True @@ -389,7 +395,7 @@ class InventoryBatchView(BatchMasterView): else: data['units'] = float((price / product.regular_price.price).quantize(decimal.Decimal('0.01'))) - result = {'product': data, 'upc_raw': entry, 'upc': None} + result = {'product': data, 'upc_raw': entry, 'upc': None, 'force_unit_item': unit_forced} if not data: upc = re.sub(r'\D', '', entry.strip()) if upc: @@ -513,6 +519,11 @@ class InventoryBatchView(BatchMasterView): product = self.find_product(entry) if product: + force_unit_item = True # TODO: make configurable? + if force_unit_item and product.is_pack_item(): + product = product.unit + self.request.session.flash("You scanned a pack item, but must count the units instead.", 'error') + aggregate = self.should_aggregate_products(batch) if aggregate: row = self.find_row_for_product(batch, product)