[FIX] ir_property: Allows to search on boolean == False

Closes #43580
Fixes #9449

Adds field type conditions for boolean in search for Property model.

As False values are not stored in DB for boolean, the search() does
not return any value for non existent lines with:

* operator: '=' and value: False
* operator: '!=' and value: True

Uses the 'include_zero' and inverse operator mechanisms implemented
in Property model.

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
Denis Roussel
2020-02-03 14:07:10 +00:00
parent 8d2f06750d
commit 68f5883aff
+7 -1
View File
@@ -418,7 +418,13 @@ class Property(models.Model):
elif value > 0 and operator == '<':
operator = '>='
include_zero = True
elif field.type == 'boolean':
if not value and operator == '=':
operator = '!='
include_zero = True
elif value and operator == '!=':
operator = '='
include_zero = True
# retrieve the properties that match the condition
domain = self._get_domain(name, model)