Skip to content
Snippets Groups Projects
Commit 7576ae51 authored by Toufik Ben Jaa's avatar Toufik Ben Jaa
Browse files

[FIX] base: avoid crash on empty record rule domain


- Since 12.2 when a record rule forbids you to access a record
an error message is displayed with the list of the record rules
that have forbid the access and an example of the forbidden records.

The issue here is that a specific message is displayed to warn the
user that the record rule may be a "Multi-company" record rule.

To do so, it checks if `company_id` is present in the record rules'
domain but if the domain is empty it crashes.

OPW-2004827

closes odoo/odoo#33801

Signed-off-by: default avatarToufik Benjaa (tbe) <tbe@odoo.com>
parent 995aa168
Branches
Tags
No related merge requests found
......@@ -209,7 +209,7 @@ class IrRule(models.Model):
'document_model': model,
'rules_list': '\n'.join('- %s' % rule.name for rule in rules),
'multi_company_warning': ('\n' + _('Note: this might be a multi-company issue.') + '\n') if any(
'company_id' in r.domain_force for r in rules) else '',
'company_id' in (r.domain_force or []) for r in rules) else '',
'example_records': list(records.ids[:6]),
'user_id': self.env.user.id,
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment