diff options
| author | Toufik Ben Jaa <tbe@odoo.com> | 2019-03-06 12:15:35 +0000 |
|---|---|---|
| committer | Toufik Ben Jaa <tbe@odoo.com> | 2019-03-06 12:15:35 +0000 |
| commit | 5805c032a4c8d388df2909715aac5eef8f464944 (patch) | |
| tree | 7e7b79cfdbb0744ac77fa9834ce43222e472e921 /addons | |
| parent | e4c434c6ff00af85ba10de5cef2c99a56afb82c4 (diff) | |
[FIX] analytic: name_search return no results
- Since the commit 5fcf891e07bf61518e6bf0be0dc4f27859d45778 an issue has
been introduced in the `analytic.account.analytic` name_search method.
In some cases searching through analytic accounts will return no
results when it should.
The issue is due to a bug in `expression.py` that doesn't correctly
handle the fields in `auto_join`.
The issue is described here https://github.com/odoo/odoo/issues/25175
and will be fixed by the ORM team.
closes odoo/odoo#31628
Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/analytic/models/analytic_account.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/analytic/models/analytic_account.py b/addons/analytic/models/analytic_account.py index bc88e94a19e..acd5dfbc160 100644 --- a/addons/analytic/models/analytic_account.py +++ b/addons/analytic/models/analytic_account.py @@ -160,7 +160,10 @@ class AccountAnalyticAccount(models.Model): if operator == 'ilike' and not (name or '').strip(): domain = [] else: - domain = ['|', '|', ('code', operator, name), ('name', operator, name), ('partner_id.name', operator, name)] + # `partner_id` is in auto_join and the searches using ORs with auto_join fields doesn't work + # we have to cut the search in two searches ... https://github.com/odoo/odoo/issues/25175 + partner_ids = self.env['res.partner']._search([('name', operator, name)], limit=limit, access_rights_uid=name_get_uid) + domain = ['|', '|', ('code', operator, name), ('name', operator, name), ('partner_id', 'in', partner_ids)] analytic_account_ids = self._search(expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid) return self.browse(analytic_account_ids).name_get() |
