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