[IMP] base: deprecate global rules

ir.model.access rules without group will now log a warning

Part-of: odoo/odoo#125216
This commit is contained in:
Xavier Morel
2023-07-11 22:33:47 +02:00
committed by Martin Trigaux
parent c68fa610d4
commit ce1a4a2ee0
+7
View File
@@ -1941,6 +1941,13 @@ class IrModelAccess(models.Model):
@api.model_create_multi
def create(self, vals_list):
self.call_cache_clearing_methods()
for ima in vals_list:
if "group_id" in ima and not ima["group_id"] and any([
ima.get("perm_read"),
ima.get("perm_write"),
ima.get("perm_create"),
ima.get("perm_unlink")]):
_logger.warning("Rule %s has no group, this is a deprecated feature. Every access-granting rule should specify a group.", ima['name'])
return super(IrModelAccess, self).create(vals_list)
def write(self, values):