rattail-demo/rattail_demo/web/views/corepos/departments.py

71 lines
1.6 KiB
Python
Raw Normal View History

2018-11-22 11:16:59 -06:00
# -*- coding: utf-8; -*-
"""
CORE-POS department views
"""
from __future__ import unicode_literals, absolute_import
from corepos.db import model as corepos
from .master import CoreMasterView
class DepartmentView(CoreMasterView):
"""
Base class for department views.
"""
model_class = corepos.Department
model_title = "CORE-POS Department"
url_prefix = '/core-pos/departments'
route_prefix = 'corepos.departments'
labels = {
'dept_no': "Number",
'dept_name': "Name",
'dept_tax': "Tax",
'dept_fs': "FS",
'dept_limit': "Limit",
'dept_minimum': "Minimum",
'dept_discount': "Discount",
'dept_see_id': "See ID",
'modifiedby': "Modified by",
'salesCode': "Sales Code",
'memberOnly': "Member Only",
}
grid_columns = [
'dept_no',
'dept_name',
'dept_tax',
'dept_fs',
'dept_limit',
'dept_minimum',
'dept_discount',
'dept_see_id',
'modified',
'modifiedby',
'margin',
'salesCode',
'memberOnly',
]
def configure_grid(self, g):
super(DepartmentView, self).configure_grid(g)
g.filters['dept_no'].default_active = True
g.filters['dept_no'].default_verb = 'equal'
g.filters['dept_name'].default_active = True
g.filters['dept_name'].default_verb = 'contains'
g.set_type('modified', 'datetime_local')
g.set_sort_defaults('dept_no')
g.set_link('dept_no')
g.set_link('dept_name')
def includeme(config):
DepartmentView.defaults(config)