source: rattail-demo/rattail_demo/web/views/corepos/departments.py @ e20a9b8

Last change on this file since e20a9b8 was e20a9b8, checked in by Lance Edgar <lance@…>, 14 months ago

Add basic CORE-POS table views

  • Property mode set to 100644
File size: 1.6 KB
Line 
1# -*- coding: utf-8; -*-
2"""
3CORE-POS department views
4"""
5
6from __future__ import unicode_literals, absolute_import
7
8from corepos.db import model as corepos
9
10from .master import CoreMasterView
11
12
13class DepartmentView(CoreMasterView):
14    """
15    Base class for department views.
16    """
17    model_class = corepos.Department
18    model_title = "CORE-POS Department"
19    url_prefix = '/core-pos/departments'
20    route_prefix = 'corepos.departments'
21
22    labels = {
23        'dept_no': "Number",
24        'dept_name': "Name",
25        'dept_tax': "Tax",
26        'dept_fs': "FS",
27        'dept_limit': "Limit",
28        'dept_minimum': "Minimum",
29        'dept_discount': "Discount",
30        'dept_see_id': "See ID",
31        'modifiedby': "Modified by",
32        'salesCode': "Sales Code",
33        'memberOnly': "Member Only",
34    }
35
36    grid_columns = [
37        'dept_no',
38        'dept_name',
39        'dept_tax',
40        'dept_fs',
41        'dept_limit',
42        'dept_minimum',
43        'dept_discount',
44        'dept_see_id',
45        'modified',
46        'modifiedby',
47        'margin',
48        'salesCode',
49        'memberOnly',
50    ]
51
52    def configure_grid(self, g):
53        super(DepartmentView, self).configure_grid(g)
54
55        g.filters['dept_no'].default_active = True
56        g.filters['dept_no'].default_verb = 'equal'
57
58        g.filters['dept_name'].default_active = True
59        g.filters['dept_name'].default_verb = 'contains'
60
61        g.set_type('modified', 'datetime_local')
62
63        g.set_sort_defaults('dept_no')
64
65        g.set_link('dept_no')
66        g.set_link('dept_name')
67
68
69def includeme(config):
70    DepartmentView.defaults(config)
Note: See TracBrowser for help on using the repository browser.