From 60cc35b3ddcd0bfae1093ba3b233cd620d886e5c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 18 Jan 2023 20:12:42 -0600 Subject: [PATCH] Add way to override CORE-POS data views i.e. when you want to "include all except not this one" etc. --- tailbone_corepos/views/corepos/__init__.py | 51 ++++++++++++---------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/tailbone_corepos/views/corepos/__init__.py b/tailbone_corepos/views/corepos/__init__.py index 82a07d3..7cbf0d9 100644 --- a/tailbone_corepos/views/corepos/__init__.py +++ b/tailbone_corepos/views/corepos/__init__.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2022 Lance Edgar +# Copyright © 2010-2023 Lance Edgar # # This file is part of Rattail. # @@ -27,25 +27,32 @@ CORE POS views from .master import CoreOfficeMasterView +def defaults(config, **kwargs): + + mod = lambda spec: kwargs.get(spec, spec) + + config.include(mod('tailbone_corepos.views.corepos.parameters')) + config.include(mod('tailbone_corepos.views.corepos.tablesyncrules')) + config.include(mod('tailbone_corepos.views.corepos.users')) + config.include(mod('tailbone_corepos.views.corepos.groups')) + config.include(mod('tailbone_corepos.views.corepos.stores')) + config.include(mod('tailbone_corepos.views.corepos.departments')) + config.include(mod('tailbone_corepos.views.corepos.subdepartments')) + config.include(mod('tailbone_corepos.views.corepos.superdepartments')) + config.include(mod('tailbone_corepos.views.corepos.vendors')) + config.include(mod('tailbone_corepos.views.corepos.origins')) + config.include(mod('tailbone_corepos.views.corepos.products')) + config.include(mod('tailbone_corepos.views.corepos.likecodes')) + config.include(mod('tailbone_corepos.views.corepos.scaleitems')) + config.include(mod('tailbone_corepos.views.corepos.members')) + config.include(mod('tailbone_corepos.views.corepos.customers')) + config.include(mod('tailbone_corepos.views.corepos.employees')) + config.include(mod('tailbone_corepos.views.corepos.coupons')) + config.include(mod('tailbone_corepos.views.corepos.taxrates')) + config.include(mod('tailbone_corepos.views.corepos.transactions')) + config.include(mod('tailbone_corepos.views.corepos.batches')) + config.include(mod('tailbone_corepos.views.corepos.purchaseorders')) + + def includeme(config): - config.include('tailbone_corepos.views.corepos.parameters') - config.include('tailbone_corepos.views.corepos.tablesyncrules') - config.include('tailbone_corepos.views.corepos.users') - config.include('tailbone_corepos.views.corepos.groups') - config.include('tailbone_corepos.views.corepos.stores') - config.include('tailbone_corepos.views.corepos.departments') - config.include('tailbone_corepos.views.corepos.subdepartments') - config.include('tailbone_corepos.views.corepos.superdepartments') - config.include('tailbone_corepos.views.corepos.vendors') - config.include('tailbone_corepos.views.corepos.origins') - config.include('tailbone_corepos.views.corepos.products') - config.include('tailbone_corepos.views.corepos.likecodes') - config.include('tailbone_corepos.views.corepos.scaleitems') - config.include('tailbone_corepos.views.corepos.members') - config.include('tailbone_corepos.views.corepos.customers') - config.include('tailbone_corepos.views.corepos.employees') - config.include('tailbone_corepos.views.corepos.coupons') - config.include('tailbone_corepos.views.corepos.taxrates') - config.include('tailbone_corepos.views.corepos.transactions') - config.include('tailbone_corepos.views.corepos.batches') - config.include('tailbone_corepos.views.corepos.purchaseorders') + defaults(config)