summaryrefslogtreecommitdiff
path: root/addons/web/models
diff options
context:
space:
mode:
authorMathieu Duckerts-Antoine <dam@odoo.com>2020-06-05 09:19:21 +0000
committerJulien Mougenot <jum@odoo.com>2020-06-12 13:34:04 +0000
commit7002bdb2398ff89339493c99d00f4016d65f70c4 (patch)
treea10303706f5ecf4d0c1800ea72ae37ad6c91de8b /addons/web/models
parent8a2a25e7fc5db951ecb7b00d89c6182c5bf56da1 (diff)
[FIX] web: always use filter_domain for search panel counters
The counters for categories were not updated when filter values were selected. This commit fixes that situation. This might impact the global performances of the search panel but there is still room for improvement. Actually, it could be possible to reload categories and filters less often by carefully track the internal changes and the categories/filters attributes (enable counters, expand,...). closes odoo/odoo#49307 Related: odoo/enterprise#9795 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/models')
-rw-r--r--addons/web/models/models.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/models/models.py b/addons/web/models/models.py
index f98a3d8c7bb..f4bcdb9be06 100644
--- a/addons/web/models/models.py
+++ b/addons/web/models/models.py
@@ -456,6 +456,7 @@ class Base(models.AbstractModel):
:param expand: whether to return the full range of field values in comodel_domain
or only the field image values (possibly filtered and/or completed
with parents if hierarchize is set). Default is False.
+ :param filter_domain: domain generated by filters. Default is [].
:param hierarchize: determines if the categories must be displayed hierarchically
(if possible). If set to true and _parent_name is set on the
comodel field, the information necessary for the hierarchization will
@@ -479,7 +480,10 @@ class Base(models.AbstractModel):
'supported_types': supported_types, 'field_type': field.type}))
model_domain = kwargs.get('search_domain', [])
- extra_domain = kwargs.get('category_domain', [])
+ extra_domain = AND([
+ kwargs.get('category_domain', []),
+ kwargs.get('filter_domain', []),
+ ])
if field.type == 'selection':
return {