[FIX] account: import invoice with tax
The import feature is using a `=` as the operator. To reproduce: Import a file like this ``` partner_id,journal_id,currency_id,date,invoice_line_ids/account,invoice_line_ids/name,invoice_line_ids/quantity,invoice_line_ids/price_unit,invoice_line_ids/taxes Publiroute,Customer invoices,EUR,18/06/2021,700000,Prof services 05/2021,1,100,21% ``` In this case, the ORM would look for a tax with the name equal to `2%1` instead of `21%`. This of course valid for any other way of using the equality operator in the domain. closes odoo/odoo#104764 X-original-commit: af46d8a567215a07b18d00f7d513681d385a8e7b Signed-off-by: Julien Castiaux <juc@odoo.com> Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -193,12 +193,14 @@ class AccountTax(models.Model):
|
||||
return '%'.join(list(name))
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
return super().name_search(name=AccountTax._parse_name_search(name), args=args, operator=operator, limit=limit)
|
||||
def _name_search(self, name='', args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||
if operator in ("ilike", "like"):
|
||||
name = AccountTax._parse_name_search(name)
|
||||
return super()._name_search(name, args, operator, limit, name_get_uid)
|
||||
|
||||
def _search_name(self, operator, value):
|
||||
if operator not in ("ilike", "like") or not isinstance(value, str):
|
||||
return super()._search_name(operator, value)
|
||||
return [('name', operator, value)]
|
||||
return [('name', operator, AccountTax._parse_name_search(value))]
|
||||
|
||||
def _check_repartition_lines(self, lines):
|
||||
|
||||
Reference in New Issue
Block a user