diff --git a/tailbone/views/inventory.py b/tailbone/views/inventory.py index b10ade6f..f3252d57 100644 --- a/tailbone/views/inventory.py +++ b/tailbone/views/inventory.py @@ -94,6 +94,9 @@ class InventoryBatchView(BatchMasterView): mobile_creatable = True mobile_rows_creatable = True + # set to False to disable "zero all" batch count mode + allow_zero_all = True + labels = { 'mode': "Count Mode", } @@ -208,7 +211,7 @@ class InventoryBatchView(BatchMasterView): modes.pop(self.enum.INVENTORY_MODE_REPLACE, None) if hasattr(self.enum, 'INVENTORY_MODE_REPLACE_ADJUST'): modes.pop(self.enum.INVENTORY_MODE_REPLACE_ADJUST, None) - if not self.request.has_perm('{}.create.zero'.format(permission_prefix)): + if not self.allow_zero_all or not self.request.has_perm('{}.create.zero'.format(permission_prefix)): if hasattr(self.enum, 'INVENTORY_MODE_ZERO_ALL'): modes.pop(self.enum.INVENTORY_MODE_ZERO_ALL, None) return modes @@ -584,8 +587,9 @@ class InventoryBatchView(BatchMasterView): # extra perms for creating batches per "mode" config.add_tailbone_permission(permission_prefix, '{}.create.replace'.format(permission_prefix), "Create new {} with 'replace' mode".format(model_title)) - config.add_tailbone_permission(permission_prefix, '{}.create.zero'.format(permission_prefix), - "Create new {} with 'zero' mode".format(model_title)) + if cls.allow_zero_all: + config.add_tailbone_permission(permission_prefix, '{}.create.zero'.format(permission_prefix), + "Create new {} with 'zero' mode".format(model_title)) # row UPC lookup, for desktop config.add_route('{}.desktop_lookup'.format(route_prefix), '{}/{{{}}}/desktop-form/lookup'.format(url_prefix, model_key))