Force user to count "units" and not "packs" for inventory batch
at least until we come up with something smarter...
This commit is contained in:
parent
469f9cf015
commit
c88d060fe0
|
@ -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 @@
|
|||
<div class="img-wrapper"><img /></div>
|
||||
<div class="warning notfound">please confirm UPC and provide more details</div>
|
||||
<div class="warning present">product already exists in batch, please confirm count</div>
|
||||
<div class="warning force-unit">pack item scanned, but must count units instead</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue