Expose new "calculated" invoice totals for receiving batch, rows

This commit is contained in:
Lance Edgar 2019-03-07 17:05:25 -06:00
parent 3760c3239f
commit d337defb09
2 changed files with 44 additions and 4 deletions

View file

@ -144,6 +144,7 @@ class PurchasingBatchView(BatchMasterView):
'invoice_line_number', 'invoice_line_number',
'invoice_unit_cost', 'invoice_unit_cost',
'invoice_total', 'invoice_total',
'invoice_total_calculated',
'status_code', 'status_code',
'credits', 'credits',
] ]
@ -205,6 +206,14 @@ class PurchasingBatchView(BatchMasterView):
g.filters['complete'].default_active = True g.filters['complete'].default_active = True
g.filters['complete'].default_verb = 'is_true' g.filters['complete'].default_verb = 'is_true'
# invoice_total
g.set_type('invoice_total', 'currency')
g.set_label('invoice_total', "Total")
# invoice_total_calculated
g.set_type('invoice_total_calculated', 'currency')
g.set_label('invoice_total_calculated', "Total")
g.set_label('date_ordered', "Ordered") g.set_label('date_ordered', "Ordered")
g.set_label('date_received', "Received") g.set_label('date_received', "Received")
@ -347,6 +356,10 @@ class PurchasingBatchView(BatchMasterView):
f.set_readonly('invoice_total') f.set_readonly('invoice_total')
f.set_type('invoice_total', 'currency') f.set_type('invoice_total', 'currency')
# invoice_total_calculated
f.set_readonly('invoice_total_calculated')
f.set_type('invoice_total_calculated', 'currency')
# vendor_email # vendor_email
f.set_readonly('vendor_email') f.set_readonly('vendor_email')
f.set_renderer('vendor_email', self.render_vendor_email) f.set_renderer('vendor_email', self.render_vendor_email)
@ -603,7 +616,6 @@ 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('invoice_total', '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
@ -617,8 +629,15 @@ class PurchasingBatchView(BatchMasterView):
g.set_label('units_received', "Units Rec.") g.set_label('units_received', "Units Rec.")
g.filters['units_received'].label = "Units Received" g.filters['units_received'].label = "Units Received"
g.set_label('po_total', "Total") # invoice_total
g.set_type('invoice_total', 'currency')
g.set_label('invoice_total', "Total") g.set_label('invoice_total', "Total")
# invoice_total_calculated
g.set_type('invoice_total_calculated', 'currency')
g.set_label('invoice_total_calculated', "Total")
g.set_label('po_total', "Total")
g.set_label('credits', "Credits?") g.set_label('credits', "Credits?")
def make_row_grid_tools(self, batch): def make_row_grid_tools(self, batch):
@ -664,11 +683,20 @@ class PurchasingBatchView(BatchMasterView):
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('invoice_unit_cost', 'currency') f.set_type('invoice_unit_cost', 'currency')
f.set_type('invoice_total', 'currency')
# upc # upc
f.set_type('upc', 'gpc') f.set_type('upc', 'gpc')
# invoice total
f.set_readonly('invoice_total')
f.set_type('invoice_total', 'currency')
f.set_label('invoice_total', "Invoice Total (Orig.)")
# invoice total_calculated
f.set_readonly('invoice_total_calculated')
f.set_type('invoice_total_calculated', 'currency')
f.set_label('invoice_total_calculated', "Invoice Total (Calc.)")
# credits # credits
f.set_readonly('credits') f.set_readonly('credits')
f.set_renderer('credits', self.render_row_credits) f.set_renderer('credits', self.render_row_credits)

View file

@ -161,6 +161,7 @@ class ReceivingBatchView(PurchasingBatchView):
'created', 'created',
'created_by', 'created_by',
'rowcount', 'rowcount',
'invoice_total_calculated',
'status_code', 'status_code',
'executed', 'executed',
] ]
@ -191,6 +192,7 @@ class ReceivingBatchView(PurchasingBatchView):
'invoice_date', 'invoice_date',
'invoice_number', 'invoice_number',
'invoice_total', 'invoice_total',
'invoice_total_calculated',
'notes', 'notes',
'created', 'created',
'created_by', 'created_by',
@ -221,7 +223,7 @@ class ReceivingBatchView(PurchasingBatchView):
'cases_received', 'cases_received',
'units_received', 'units_received',
# 'po_total', # 'po_total',
'invoice_total', 'invoice_total_calculated',
'credits', 'credits',
'status_code', 'status_code',
'truck_dump_status', 'truck_dump_status',
@ -252,6 +254,7 @@ class ReceivingBatchView(PurchasingBatchView):
'invoice_line_number', 'invoice_line_number',
'invoice_unit_cost', 'invoice_unit_cost',
'invoice_total', 'invoice_total',
'invoice_total_calculated',
'status_code', 'status_code',
'truck_dump_status', 'truck_dump_status',
'claims', 'claims',
@ -418,6 +421,10 @@ class ReceivingBatchView(PurchasingBatchView):
if not self.editing: if not self.editing:
f.remove_field('order_quantities_known') f.remove_field('order_quantities_known')
# invoice totals
f.set_label('invoice_total', "Invoice Total (Orig.)")
f.set_label('invoice_total_calculated', "Invoice Total (Calc.)")
def template_kwargs_create(self, **kwargs): def template_kwargs_create(self, **kwargs):
kwargs = super(ReceivingBatchView, self).template_kwargs_create(**kwargs) kwargs = super(ReceivingBatchView, self).template_kwargs_create(**kwargs)
if self.allow_truck_dump: if self.allow_truck_dump:
@ -849,7 +856,12 @@ class ReceivingBatchView(PurchasingBatchView):
f.set_readonly('units_ordered') f.set_readonly('units_ordered')
f.set_readonly('po_unit_cost') f.set_readonly('po_unit_cost')
f.set_readonly('po_total') f.set_readonly('po_total')
# invoice totals
f.set_readonly('invoice_total') f.set_readonly('invoice_total')
f.set_label('invoice_total', "Invoice Total (Orig.)")
f.set_readonly('invoice_total_calculated')
f.set_label('invoice_total_calculated', "Invoice Total (Calc.)")
# claims # claims
f.set_readonly('claims') f.set_readonly('claims')