Fix PO unit cost calculation for ordering row, batch
This commit is contained in:
parent
8bb09f5739
commit
512084194d
|
@ -264,18 +264,21 @@ class OrderingBatchView(PurchasingBatchView):
|
|||
row.removed = False
|
||||
batch.rowcount += 1
|
||||
self.handler.refresh_row(row)
|
||||
if row.po_unit_cost:
|
||||
row.po_total = row.po_unit_cost * self.handler.get_units_ordered(row)
|
||||
batch.po_total = (batch.po_total or 0) + row.po_total
|
||||
else:
|
||||
row.removed = True
|
||||
|
||||
elif cases_ordered or units_ordered:
|
||||
row = model.PurchaseBatchRow()
|
||||
row.sequence = max([0] + [r.sequence for r in batch.data_rows]) + 1
|
||||
row.product = product
|
||||
batch.data_rows.append(row)
|
||||
row.cases_ordered = cases_ordered or None
|
||||
row.units_ordered = units_ordered or None
|
||||
self.handler.refresh_row(row)
|
||||
batch.rowcount = (batch.rowcount or 0) + 1
|
||||
self.handler.add_row(batch, row)
|
||||
if row.po_unit_cost:
|
||||
row.po_total = row.po_unit_cost * self.handler.get_units_ordered(row)
|
||||
batch.po_total = (batch.po_total or 0) + row.po_total
|
||||
|
||||
return {
|
||||
'row_cases_ordered': '' if not row or row.removed else int(row.cases_ordered or 0),
|
||||
|
|
Loading…
Reference in a new issue