Skip to content

Commit

Permalink
[FIX] fix sharing intercompany contact
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbeau authored and Kev-Roche committed Jul 23, 2024
1 parent c5b0aae commit 9258d71
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions security_rule_not_editable/models/ir_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ def create(self, vals_list):
self._ensure_install_mode()
return super().create(vals_list)

def _is_useless_write_on_active(self, vals):
"""Return True if we try to only write the field 'active' and the
records already have the same value"""
return set(vals.keys()) == {"active"} and set(self.mapped("active")) == {
vals["active"]
}

def write(self, vals):
if self._is_useless_write_on_active(vals):
return True
self._ensure_install_mode()
return super().write(vals)

0 comments on commit 9258d71

Please sign in to comment.