Use common logic to render invoice total for receiving

and avoid error if total is none
This commit is contained in:
Lance Edgar 2023-12-20 11:56:24 -06:00
parent 90e35ee3db
commit 3bdc7175a3

View file

@ -1857,6 +1857,7 @@ class ReceivingBatchView(PurchasingBatchView):
"""
AJAX view for updating various cost fields in a data row.
"""
app = self.get_rattail_app()
model = self.model
batch = self.get_instance()
data = dict(get_form_data(self.request))
@ -1891,10 +1892,10 @@ class ReceivingBatchView(PurchasingBatchView):
'catalog_cost_confirmed': row.catalog_cost_confirmed,
'invoice_unit_cost': self.render_simple_unit_cost(row, 'invoice_unit_cost'),
'invoice_cost_confirmed': row.invoice_cost_confirmed,
'invoice_total_calculated': '{:0.2f}'.format(row.invoice_total_calculated),
'invoice_total_calculated': app.render_currency(row.invoice_total_calculated),
},
'batch': {
'invoice_total_calculated': '{:0.2f}'.format(batch.invoice_total_calculated),
'invoice_total_calculated': app.render_currency(batch.invoice_total_calculated),
},
}