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

74 lines
1.8 KiB
Python
Raw Normal View History

2018-11-22 11:16:59 -06:00
# -*- coding: utf-8; -*-
"""
CORE-POS customer views
"""
from __future__ import unicode_literals, absolute_import
from corepos.db import model as corepos
from .master import CoreMasterView
class CustomerView(CoreMasterView):
"""
Base class for customer views.
"""
model_class = corepos.Customer
model_title = "CORE-POS Customer"
url_prefix = '/core-pos/customers'
route_prefix = 'corepos.customers'
labels = {
'id': "ID",
'CardNo': "Card No.",
'personNum': "Person No.",
'LastName': "Last Name",
'FirstName': "First Name",
'CashBack': "Cash Back",
'MemDiscountLimit': "Member Discount Limit",
'ChargeLimit': "Charge Limit",
'ChargeOk': "Charge OK",
'WriteChecks': "Write Checks",
'StoreCoupons': "Store Coupons",
'memType': "Member Type No.",
'NumberOfChecks': "Number of Checks",
'memCoupons': "Member Coupons",
'blueLine': "Blue Line",
'LastChange': "Last Change",
}
grid_columns = [
'CardNo',
'FirstName',
'LastName',
'ChargeOk',
'ChargeLimit',
'Balance',
'WriteChecks',
'Purchases',
]
def configure_grid(self, g):
super(CustomerView, self).configure_grid(g)
g.filters['FirstName'].default_active = True
g.filters['FirstName'].default_verb = 'contains'
g.filters['LastName'].default_active = True
g.filters['LastName'].default_verb = 'contains'
g.set_type('ChargeLimit', 'currency')
g.set_type('Balance', 'currency')
g.set_type('Purchases', 'currency')
g.set_sort_defaults('CardNo')
g.set_link('CardNo')
g.set_link('FirstName')
g.set_link('LastName')
def includeme(config):
CustomerView.defaults(config)