summaryrefslogtreecommitdiff
path: root/odoo/osv/expression.py
diff options
context:
space:
mode:
authorlen-odoo <len@odoo.com>2018-11-16 14:29:42 +0000
committerNans Lefebvre <len@odoo.com>2018-12-20 10:41:43 +0000
commite5486c12bca68ac6bce7827f75435d4630de2fb4 (patch)
tree84606323b5d1076fad392e1d6acd6077b5781636 /odoo/osv/expression.py
parent03291bdcc81a8183d0a8d376fcf2f20788aaed3a (diff)
[FIX] osv: fix combination of unit domain
Combining a list of elements containing only the monoid's unit should return the unit. Since the unit is skipped, it would return an empty domain instead of the unit, meaning that (0, '=', 1) could not be used in a group rule. To test this, create a record rule on a model M with domain (0, '=', 1) that applies to group G. Log in with a user in group G and access model M; you can read everything (provided no other record rule applies) whereas you should see nothing. Because of expression.AND(global_domains + [expression.OR(group_domains)]) we want the empty domain to still be left untouched, even if it violates the OR's unit rules (i.e. OR(empty, OR(R)) = OR(R) <=> OR(empty) = unit). Meaning that no group rule would reduce to having a (0, '=' 1) group rule. So in the end we don't really care about all that algebraic nonsense. closes odoo/odoo#28765
Diffstat (limited to 'odoo/osv/expression.py')
-rw-r--r--odoo/osv/expression.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/odoo/osv/expression.py b/odoo/osv/expression.py
index 483f325322c..f5518fead94 100644
--- a/odoo/osv/expression.py
+++ b/odoo/osv/expression.py
@@ -251,6 +251,8 @@ def combine(operator, unit, zero, domains):
"""
result = []
count = 0
+ if domains == [unit]:
+ return unit
for domain in domains:
if domain == unit:
continue