Fix some UOM bugs for new customer order

This commit is contained in:
Lance Edgar 2021-01-27 08:50:20 -06:00
parent 480d878db8
commit d1d64ec96c
2 changed files with 24 additions and 14 deletions

View file

@ -363,13 +363,18 @@ class CustomerOrdersView(MasterView):
unit_uom = self.enum.UNIT_OF_MEASURE_POUND if data['product_weighed'] else self.enum.UNIT_OF_MEASURE_EACH
if row.order_uom == self.enum.UNIT_OF_MEASURE_CASE:
if row.case_quantity is None:
case_qty = unit_qty = '??'
else:
case_qty = data['case_quantity']
unit_qty = pretty_quantity(row.order_quantity * row.case_quantity)
data.update({
'order_quantity_display': "{} {} (× {} {} = {} {})".format(
data['order_quantity'],
self.enum.UNIT_OF_MEASURE[self.enum.UNIT_OF_MEASURE_CASE],
data['case_quantity'],
case_qty,
self.enum.UNIT_OF_MEASURE[unit_uom],
pretty_quantity(row.order_quantity * row.case_quantity),
unit_qty,
self.enum.UNIT_OF_MEASURE[unit_uom]),
})
else: