Fix PO total calculation bug for mobile ordering
also fix currency formatting for PO calculated total
This commit is contained in:
parent
975aa0a3cc
commit
355a49e463
|
@ -232,10 +232,13 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
|
|
||||||
# po_total
|
# po_total
|
||||||
if self.creating:
|
if self.creating:
|
||||||
f.remove_field('po_total')
|
f.remove_fields('po_total',
|
||||||
|
'po_total_calculated')
|
||||||
else:
|
else:
|
||||||
f.set_readonly('po_total')
|
f.set_readonly('po_total')
|
||||||
f.set_type('po_total', 'currency')
|
f.set_type('po_total', 'currency')
|
||||||
|
f.set_readonly('po_total_calculated')
|
||||||
|
f.set_type('po_total_calculated', 'currency')
|
||||||
|
|
||||||
def configure_form(self, f):
|
def configure_form(self, f):
|
||||||
super(PurchasingBatchView, self).configure_form(f)
|
super(PurchasingBatchView, self).configure_form(f)
|
||||||
|
@ -618,6 +621,7 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
g.set_type('cases_received', 'quantity')
|
g.set_type('cases_received', 'quantity')
|
||||||
g.set_type('units_received', 'quantity')
|
g.set_type('units_received', 'quantity')
|
||||||
g.set_type('po_total', 'currency')
|
g.set_type('po_total', 'currency')
|
||||||
|
g.set_type('po_total_calculated', 'currency')
|
||||||
g.set_type('credits', 'boolean')
|
g.set_type('credits', 'boolean')
|
||||||
|
|
||||||
# we only want the grid column to have abbreviated label, but *not* the filter
|
# we only want the grid column to have abbreviated label, but *not* the filter
|
||||||
|
@ -690,6 +694,7 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
# currency fields
|
# currency fields
|
||||||
f.set_type('po_unit_cost', 'currency')
|
f.set_type('po_unit_cost', 'currency')
|
||||||
f.set_type('po_total', 'currency')
|
f.set_type('po_total', 'currency')
|
||||||
|
f.set_type('po_total_calculated', 'currency')
|
||||||
f.set_type('invoice_unit_cost', 'currency')
|
f.set_type('invoice_unit_cost', 'currency')
|
||||||
|
|
||||||
# upc
|
# upc
|
||||||
|
@ -794,8 +799,10 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
# currency fields
|
# currency fields
|
||||||
f.set_type('po_unit_cost', 'currency')
|
f.set_type('po_unit_cost', 'currency')
|
||||||
f.set_type('po_total', 'currency')
|
f.set_type('po_total', 'currency')
|
||||||
|
f.set_type('po_total_calculated', 'currency')
|
||||||
f.set_type('invoice_unit_cost', 'currency')
|
f.set_type('invoice_unit_cost', 'currency')
|
||||||
f.set_type('invoice_total', 'currency')
|
f.set_type('invoice_total', 'currency')
|
||||||
|
f.set_type('invoice_total_calculated', 'currency')
|
||||||
|
|
||||||
# if self.creating:
|
# if self.creating:
|
||||||
# f.remove_fields(
|
# f.remove_fields(
|
||||||
|
@ -911,7 +918,7 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
# now apply new totals based on current row quantity
|
# now apply new totals based on current row quantity
|
||||||
if batch.mode == self.enum.PURCHASE_BATCH_MODE_ORDERING and row.po_unit_cost is not None:
|
if batch.mode == self.enum.PURCHASE_BATCH_MODE_ORDERING and row.po_unit_cost is not None:
|
||||||
row.po_total_calculated = row.po_unit_cost * self.handler.get_units_ordered(row)
|
row.po_total_calculated = row.po_unit_cost * self.handler.get_units_ordered(row)
|
||||||
batch.po_total_calculated += row.po_total_calculated
|
batch.po_total_calculated = (batch.po_total_calculated or 0) + row.po_total_calculated
|
||||||
|
|
||||||
return row
|
return row
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue