Add allow_zero_all
flag for inventory batch master
defaults to true, but setting to false should disable "zero all" count mode
This commit is contained in:
parent
961e0e801d
commit
c9eeabecba
|
@ -94,6 +94,9 @@ class InventoryBatchView(BatchMasterView):
|
||||||
mobile_creatable = True
|
mobile_creatable = True
|
||||||
mobile_rows_creatable = True
|
mobile_rows_creatable = True
|
||||||
|
|
||||||
|
# set to False to disable "zero all" batch count mode
|
||||||
|
allow_zero_all = True
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
'mode': "Count Mode",
|
'mode': "Count Mode",
|
||||||
}
|
}
|
||||||
|
@ -208,7 +211,7 @@ class InventoryBatchView(BatchMasterView):
|
||||||
modes.pop(self.enum.INVENTORY_MODE_REPLACE, None)
|
modes.pop(self.enum.INVENTORY_MODE_REPLACE, None)
|
||||||
if hasattr(self.enum, 'INVENTORY_MODE_REPLACE_ADJUST'):
|
if hasattr(self.enum, 'INVENTORY_MODE_REPLACE_ADJUST'):
|
||||||
modes.pop(self.enum.INVENTORY_MODE_REPLACE_ADJUST, None)
|
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'):
|
if hasattr(self.enum, 'INVENTORY_MODE_ZERO_ALL'):
|
||||||
modes.pop(self.enum.INVENTORY_MODE_ZERO_ALL, None)
|
modes.pop(self.enum.INVENTORY_MODE_ZERO_ALL, None)
|
||||||
return modes
|
return modes
|
||||||
|
@ -584,6 +587,7 @@ class InventoryBatchView(BatchMasterView):
|
||||||
# extra perms for creating batches per "mode"
|
# extra perms for creating batches per "mode"
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.create.replace'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.create.replace'.format(permission_prefix),
|
||||||
"Create new {} with 'replace' mode".format(model_title))
|
"Create new {} with 'replace' mode".format(model_title))
|
||||||
|
if cls.allow_zero_all:
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.create.zero'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.create.zero'.format(permission_prefix),
|
||||||
"Create new {} with 'zero' mode".format(model_title))
|
"Create new {} with 'zero' mode".format(model_title))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue