feat: Add bypass_user_restriction context to various action methods across multiple models and optimize the allowed_quality_checks field.
This commit is contained in:
parent
4a049d124e
commit
b9b6e549c0
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,3 +13,9 @@ class MrpProduction(models.Model):
|
||||
# If allowed_quality_checks is True, hide = False
|
||||
# If allowed_quality_checks is False, hide = True
|
||||
record.hide_quality_check_button = not self.env.user.allowed_quality_checks
|
||||
|
||||
def action_confirm(self):
|
||||
return super(MrpProduction, self.with_context(bypass_user_restriction=True)).action_confirm()
|
||||
|
||||
def button_mark_done(self):
|
||||
return super(MrpProduction, self.with_context(bypass_user_restriction=True)).button_mark_done()
|
||||
|
||||
@ -51,5 +51,6 @@ class ResUsers(models.Model):
|
||||
allowed_quality_checks = fields.Boolean(
|
||||
string="Is Allowed todo Quality Checks?",
|
||||
default=False,
|
||||
prefetch=False,
|
||||
help="If checked, this user can see the Quality Checks button on Manufacturing Orders."
|
||||
)
|
||||
|
||||
@ -93,3 +93,9 @@ class ApprovalRequest(models.Model):
|
||||
if allowed_category_ids:
|
||||
domain = expression.AND([domain or [], [('category_id', 'in', allowed_category_ids)]])
|
||||
return super()._search(domain, offset=offset, limit=limit, order=order)
|
||||
|
||||
def action_confirm(self):
|
||||
return super(ApprovalRequest, self.with_context(bypass_user_restriction=True)).action_confirm()
|
||||
|
||||
def action_approve(self, approver=None):
|
||||
return super(ApprovalRequest, self.with_context(bypass_user_restriction=True)).action_approve(approver=approver)
|
||||
|
||||
@ -5,3 +5,6 @@ class SaleOrder(models.Model):
|
||||
|
||||
def action_confirm(self):
|
||||
return super(SaleOrder, self.with_context(bypass_user_restriction=True)).action_confirm()
|
||||
|
||||
def _action_confirm(self):
|
||||
return super(SaleOrder, self.with_context(bypass_user_restriction=True))._action_confirm()
|
||||
|
||||
@ -10,3 +10,9 @@ class StockPicking(models.Model):
|
||||
def _compute_hide_quality_check_button(self):
|
||||
for record in self:
|
||||
record.hide_quality_check_button = not self.env.user.allowed_quality_checks
|
||||
|
||||
def action_confirm(self):
|
||||
return super(StockPicking, self.with_context(bypass_user_restriction=True)).action_confirm()
|
||||
|
||||
def button_validate(self):
|
||||
return super(StockPicking, self.with_context(bypass_user_restriction=True)).button_validate()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user