Expose permissions for POS, if so configured

This commit is contained in:
Lance Edgar 2023-10-06 08:56:22 -05:00
parent e1a64de205
commit d45ee34b0c

View file

@ -89,7 +89,7 @@ class POSBatchView(BatchMasterView):
'quantity',
'sales_total',
'tender_total',
'status_code',
'user',
]
row_form_fields = [
@ -188,6 +188,32 @@ class POSBatchView(BatchMasterView):
f.set_renderer('user', self.render_user)
@classmethod
def defaults(cls, config):
cls._batch_defaults(config)
cls._defaults(config)
cls._pos_batch_defaults(config)
@classmethod
def _pos_batch_defaults(cls, config):
rattail_config = config.registry.settings.get('rattail_config')
if rattail_config.getbool('tailbone', 'expose_pos_permissions',
default=False):
config.add_tailbone_permission_group('pos', "POS", overwrite=False)
config.add_tailbone_permission('pos', 'pos.ring_sales',
"Make transactions (ring up sales)")
# config.add_tailbone_permission('pos', 'pos.resume',
# "Resume previously-suspended transaction")
# config.add_tailbone_permission('pos', 'pos.suspend',
# "Suspend current transaction")
config.add_tailbone_permission('pos', 'pos.swap_customer',
"Swap customer for current transaction")
config.add_tailbone_permission('pos', 'pos.void_txn',
"Void current transaction")
def defaults(config, **kwargs):
base = globals()