Expose tender ref in POS batch rows; new tender flags

This commit is contained in:
Lance Edgar 2023-10-06 20:34:14 -05:00
parent 2f4877a264
commit eccb855d09
3 changed files with 17 additions and 0 deletions

View file

@ -105,6 +105,7 @@ class POSBatchView(BatchMasterView):
'tax1_total', 'tax1_total',
'tax2_total', 'tax2_total',
'tender_total', 'tender_total',
'tender',
'void', 'void',
'status_code', 'status_code',
'timestamp', 'timestamp',
@ -179,6 +180,7 @@ class POSBatchView(BatchMasterView):
f.set_enum('row_type', self.enum.POS_ROW_TYPE) f.set_enum('row_type', self.enum.POS_ROW_TYPE)
f.set_renderer('product', self.render_product) f.set_renderer('product', self.render_product)
f.set_renderer('tender', self.render_tender)
f.set_type('quantity', 'quantity') f.set_type('quantity', 'quantity')
f.set_type('reg_price', 'currency') f.set_type('reg_price', 'currency')

View file

@ -861,6 +861,14 @@ class MasterView(View):
url = self.request.route_url('stores.view', uuid=store.uuid) url = self.request.route_url('stores.view', uuid=store.uuid)
return tags.link_to(text, url) return tags.link_to(text, url)
def render_tender(self, obj, field):
tender = getattr(obj, field)
if not tender:
return
text = str(tender)
url = self.request.route_url('tenders.view', uuid=tender.uuid)
return tags.link_to(text, url)
def valid_employee_uuid(self, node, value): def valid_employee_uuid(self, node, value):
if value: if value:
model = self.model model = self.model

View file

@ -41,6 +41,7 @@ class TenderView(MasterView):
'name', 'name',
'is_cash', 'is_cash',
'allow_cash_back', 'allow_cash_back',
'kick_drawer',
] ]
form_fields = [ form_fields = [
@ -48,7 +49,9 @@ class TenderView(MasterView):
'name', 'name',
'is_cash', 'is_cash',
'allow_cash_back', 'allow_cash_back',
'kick_drawer',
'notes', 'notes',
'disabled',
] ]
def configure_grid(self, g): def configure_grid(self, g):
@ -59,6 +62,10 @@ class TenderView(MasterView):
g.set_link('name') g.set_link('name')
g.set_sort_defaults('name') g.set_sort_defaults('name')
def grid_extra_class(self, tender, i):
if tender.disabled:
return 'warning'
def configure_form(self, f): def configure_form(self, f):
super().configure_form(f) super().configure_form(f)