Expose views for tenders, more columns for POS batch/rows

This commit is contained in:
Lance Edgar 2023-09-27 17:13:49 -05:00
parent abcf1e1895
commit f572757f00
4 changed files with 120 additions and 10 deletions

View file

@ -68,6 +68,10 @@ class POSBatchView(BatchMasterView):
'sales_total',
'tax1_total',
'tax2_total',
'tender_total',
'balance',
'void',
'training_mode',
'status_code',
'created',
'created_by',
@ -84,6 +88,7 @@ class POSBatchView(BatchMasterView):
'txn_price',
'quantity',
'sales_total',
'tender_total',
'status_code',
]
@ -99,7 +104,10 @@ class POSBatchView(BatchMasterView):
'sales_total',
'tax1_total',
'tax2_total',
'tender_total',
'status_code',
'timestamp',
'user',
]
def configure_grid(self, g):
@ -118,19 +126,33 @@ class POSBatchView(BatchMasterView):
g.set_type('sales_total', 'currency')
g.set_type('tax1_total', 'currency')
g.set_type('tax2_total', 'currency')
g.set_type('tender_total', 'currency')
# executed
# nb. default view should show "all recent" batches regardless
# of execution (i think..)
if 'executed' in g.filters:
g.filters['executed'].default_active = False
def grid_extra_class(self, batch, i):
if batch.void:
return 'warning'
if batch.training_mode:
return 'notice'
def configure_form(self, f):
super().configure_form(f)
app = self.get_rattail_app()
f.set_renderer('customer', self.render_customer)
f.set_type('sales_total', 'currency')
f.set_type('tax1_total', 'currency')
f.set_type('tax2_total', 'currency')
f.set_type('tender_total', 'currency')
f.set_type('tender_total', 'currency')
f.set_renderer('balance', lambda batch, field: app.render_currency(batch.get_balance()))
def configure_row_grid(self, g):
super().configure_row_grid(g)
@ -139,6 +161,7 @@ class POSBatchView(BatchMasterView):
g.set_type('reg_price', 'currency')
g.set_type('txn_price', 'currency')
g.set_type('sales_total', 'currency')
g.set_type('tender_total', 'currency')
g.set_link('product')
g.set_link('description')
@ -146,11 +169,15 @@ class POSBatchView(BatchMasterView):
def configure_row_form(self, f):
super().configure_row_form(f)
f.set_renderer('product', self.render_product)
f.set_type('quantity', 'quantity')
f.set_type('reg_price', 'currency')
f.set_type('txn_price', 'currency')
f.set_type('sales_total', 'currency')
f.set_renderer('product', self.render_product)
f.set_type('tender_total', 'currency')
f.set_renderer('user', self.render_user)
def defaults(config, **kwargs):