Expose department tax, FS flag
This commit is contained in:
parent
cd82f8927b
commit
507a9ffc71
|
@ -104,6 +104,8 @@ class POSBatchView(BatchMasterView):
|
|||
'item_entry',
|
||||
'product',
|
||||
'description',
|
||||
'department_number',
|
||||
'department_name',
|
||||
'reg_price',
|
||||
'txn_price',
|
||||
'quantity',
|
||||
|
|
|
@ -46,6 +46,8 @@ class DepartmentView(MasterView):
|
|||
'name',
|
||||
'product',
|
||||
'personnel',
|
||||
'tax',
|
||||
'food_stampable',
|
||||
'exempt_from_gross_sales',
|
||||
]
|
||||
|
||||
|
@ -54,6 +56,8 @@ class DepartmentView(MasterView):
|
|||
'name',
|
||||
'product',
|
||||
'personnel',
|
||||
'tax',
|
||||
'food_stampable',
|
||||
'exempt_from_gross_sales',
|
||||
'allow_product_deletions',
|
||||
'employees',
|
||||
|
@ -78,7 +82,7 @@ class DepartmentView(MasterView):
|
|||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(DepartmentView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
|
||||
# number
|
||||
g.set_sort_defaults('number')
|
||||
|
@ -93,7 +97,7 @@ class DepartmentView(MasterView):
|
|||
g.set_type('personnel', 'boolean')
|
||||
|
||||
def configure_form(self, f):
|
||||
super(DepartmentView, self).configure_form(f)
|
||||
super().configure_form(f)
|
||||
|
||||
f.remove_field('subdepartments')
|
||||
|
||||
|
@ -105,6 +109,9 @@ class DepartmentView(MasterView):
|
|||
f.set_type('product', 'boolean')
|
||||
f.set_type('personnel', 'boolean')
|
||||
|
||||
# tax
|
||||
f.set_renderer('tax', self.render_tax)
|
||||
|
||||
def render_employees(self, department, field):
|
||||
route_prefix = self.get_route_prefix()
|
||||
permission_prefix = self.get_permission_prefix()
|
||||
|
@ -130,7 +137,7 @@ class DepartmentView(MasterView):
|
|||
g.render_buefy_table_element(data_prop='employeesData'))
|
||||
|
||||
def template_kwargs_view(self, **kwargs):
|
||||
kwargs = super(DepartmentView, self).template_kwargs_view(**kwargs)
|
||||
kwargs = super().template_kwargs_view(**kwargs)
|
||||
department = kwargs['instance']
|
||||
department_employees = sorted(department.employees, key=str)
|
||||
|
||||
|
@ -169,7 +176,7 @@ class DepartmentView(MasterView):
|
|||
return product.department
|
||||
|
||||
def configure_row_grid(self, g):
|
||||
super(DepartmentView, self).configure_row_grid(g)
|
||||
super().configure_row_grid(g)
|
||||
|
||||
app = self.get_rattail_app()
|
||||
self.handler = app.get_products_handler()
|
||||
|
|
|
@ -918,6 +918,14 @@ class MasterView(View):
|
|||
if not vendor:
|
||||
node.raise_invalid("Vendor not found")
|
||||
|
||||
def render_tax(self, obj, field):
|
||||
tax = getattr(obj, field)
|
||||
if not tax:
|
||||
return
|
||||
text = str(tax)
|
||||
url = self.request.route_url('taxes.view', uuid=tax.uuid)
|
||||
return tags.link_to(text, url)
|
||||
|
||||
def render_department(self, obj, field):
|
||||
department = getattr(obj, field)
|
||||
if not department:
|
||||
|
|
Loading…
Reference in a new issue