Add views for CORE CustomerNotifications table

This commit is contained in:
Lance Edgar 2023-09-13 16:24:08 -05:00
parent 0fe85e6df3
commit 44a7a762d4
2 changed files with 36 additions and 0 deletions

View file

@ -57,6 +57,11 @@ def make_corepos_menu(request):
'route': 'corepos.customer_accounts_new',
'perm': 'corepos.customer_accounts_new.list',
},
{
'title': "Customer Notifications",
'route': 'corepos.customer_notifications',
'perm': 'corepos.customer_notifications.list',
},
{
'title': "Suspensions",
'route': 'corepos.suspensions',

View file

@ -237,6 +237,34 @@ class CustomerView(CoreOfficeMasterView):
g.set_sort_defaults('card_number')
class CustomerNotificationView(CoreOfficeMasterView):
"""
Master view for customers notifications
"""
model_class = corepos.CustomerNotification
model_title = "CORE-POS Customer Notification"
model_title_plural = "CORE-POS Customer Notifications"
url_prefix = '/core-pos/customer-notifications'
route_prefix = 'corepos.customer_notifications'
labels = {
'customer_id': "Customer ID",
}
def configure_grid(self, g):
super().configure_grid(g)
g.set_link('id')
g.set_sort_defaults('id', 'desc')
g.set_link('card_number')
if 'card_number' in g.filters:
g.filters['card_number'].default_active = True
g.filters['card_number'].default_verb = 'equal'
g.set_link('message')
class SuspensionView(CoreOfficeMasterView):
"""
Master view for legacy customer suspensions.
@ -313,6 +341,9 @@ def defaults(config, **kwargs):
CustomerView = kwargs.get('CustomerView', base['CustomerView'])
CustomerView.defaults(config)
CustomerNotificationView = kwargs.get('CustomerNotificationView', base['CustomerNotificationView'])
CustomerNotificationView.defaults(config)
SuspensionView = kwargs.get('SuspensionView', base['SuspensionView'])
SuspensionView.defaults(config)