From 2f5ddbfd088bca3be7b7bfccde7544ffe3806775 Mon Sep 17 00:00:00 2001 From: Dmytro Katyukha Date: Tue, 2 Feb 2021 13:48:05 +0200 Subject: [PATCH] [FIX] search_panel view: Do not apply model domain to comodel Description ----------- This commit fixes incorrect bechavior (error thrown) in case when additional `domain` provided to action (`ir.actions.act_window`) that displays view with search panel enabled. Before this commit ------------------ For example we have following models: - My Category - My Model And in category view, we have stat-button that display number of records of records in this category. On click, it have to open view for My Model, with domain like `[('category_id', '=', 42)]`. In this case, following error will be raised: ```tracaback Error: Odoo Server Error Traceback (most recent call last): ... File "/opt/odoo/custom_addons/web_view_searchpanel/models/base.py", line 60, in search_panel_select_range hierarchical_naming=False).search_read(model_domain, fields), File "/opt/odoo/odoo/odoo/models.py", line 4615, in search_read records = self.search(domain or [], offset=offset, limit=limit, order=order) File "/opt/odoo/odoo/odoo/models.py", line 1581, in search res = self._search(args, offset=offset, limit=limit, order=order, count=count) File "/opt/odoo/odoo/odoo/models.py", line 4147, in _search query = self._where_calc(args) File "/opt/odoo/odoo/odoo/models.py", line 3939, in _where_calc e = expression.expression(domain, self) File "/opt/odoo/odoo/odoo/osv/expression.py", line 673, in __init__ self.parse() File "/opt/odoo/odoo/odoo/osv/expression.py", line 854, in parse raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf))) ValueError: Invalid field 'category_id' in leaf "