[IMP] core: prevent deletion of a group with ACLs or record rules

This simply makes it less easy to screw up a database by preventing all
users to do their daily tasks.

closes odoo/odoo#57776

X-original-commit: 665a795fc1b199f4f17cc9f1257d1b36b6276e6f
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Florent de Labarre <florent.mirieu@gmail.com>
This commit is contained in:
Raphael Collet
2020-09-15 16:39:25 +00:00
co-authored by Florent de Labarre
parent c2c2fed0a2
commit c500bb0484
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1624,7 +1624,7 @@ class IrModelAccess(models.Model):
name = fields.Char(required=True, index=True)
active = fields.Boolean(default=True, help='If you uncheck the active field, it will disable the ACL without deleting it (if you delete a native ACL, it will be re-created when you reload the module).')
model_id = fields.Many2one('ir.model', string='Model', required=True, index=True, ondelete='cascade')
group_id = fields.Many2one('res.groups', string='Group', ondelete='cascade', index=True)
group_id = fields.Many2one('res.groups', string='Group', ondelete='restrict', index=True)
perm_read = fields.Boolean(string='Read Access')
perm_write = fields.Boolean(string='Write Access')
perm_create = fields.Boolean(string='Create Access')
+1 -1
View File
@@ -20,7 +20,7 @@ class IrRule(models.Model):
name = fields.Char(index=True)
active = fields.Boolean(default=True, help="If you uncheck the active field, it will disable the record rule without deleting it (if you delete a native record rule, it may be re-created when you reload the module).")
model_id = fields.Many2one('ir.model', string='Model', index=True, required=True, ondelete="cascade")
groups = fields.Many2many('res.groups', 'rule_group_rel', 'rule_group_id', 'group_id')
groups = fields.Many2many('res.groups', 'rule_group_rel', 'rule_group_id', 'group_id', ondelete='restrict')
domain_force = fields.Text(string='Domain')
perm_read = fields.Boolean(string='Apply for Read', default=True)
perm_write = fields.Boolean(string='Apply for Write', default=True)