Skip to content
Snippets Groups Projects
Commit 1e729c7c authored by Olivier Dony's avatar Olivier Dony
Browse files

[FIX] analytic: name_search with negative operators

The algorithm for matching analytic accounts based
on search term is only meant to be used for
simple, positive operators.
In other cases the results will not be what the user
expects. Falling back to the default name_search
behavior will be more useful.
parent 598856e1
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,8 @@ class account_analytic_account(models.Model):
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
if operator not in ('ilike', 'like', '=', '=like', '=ilike'):
return super(account_analytic_account, self).name_search(name, args, operator, limit)
args = args or []
domain = ['|', ('code', operator, name), ('name', operator, name)]
partners = self.env['res.partner'].search([('name', operator, name)], limit=limit)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment