diff --git a/tailbone/views/purchasing/batch.py b/tailbone/views/purchasing/batch.py index 117598b5..d1bcd144 100644 --- a/tailbone/views/purchasing/batch.py +++ b/tailbone/views/purchasing/batch.py @@ -232,10 +232,13 @@ class PurchasingBatchView(BatchMasterView): # po_total if self.creating: - f.remove_field('po_total') + f.remove_fields('po_total', + 'po_total_calculated') else: f.set_readonly('po_total') f.set_type('po_total', 'currency') + f.set_readonly('po_total_calculated') + f.set_type('po_total_calculated', 'currency') def configure_form(self, f): super(PurchasingBatchView, self).configure_form(f) @@ -618,6 +621,7 @@ class PurchasingBatchView(BatchMasterView): g.set_type('cases_received', 'quantity') g.set_type('units_received', 'quantity') g.set_type('po_total', 'currency') + g.set_type('po_total_calculated', 'currency') g.set_type('credits', 'boolean') # we only want the grid column to have abbreviated label, but *not* the filter @@ -690,6 +694,7 @@ class PurchasingBatchView(BatchMasterView): # currency fields f.set_type('po_unit_cost', 'currency') f.set_type('po_total', 'currency') + f.set_type('po_total_calculated', 'currency') f.set_type('invoice_unit_cost', 'currency') # upc @@ -794,8 +799,10 @@ class PurchasingBatchView(BatchMasterView): # currency fields f.set_type('po_unit_cost', '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_total', 'currency') + f.set_type('invoice_total_calculated', 'currency') # if self.creating: # f.remove_fields( @@ -911,7 +918,7 @@ class PurchasingBatchView(BatchMasterView): # 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: 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