[FIX] sale: search order lines by order number not working

When searching sale order lines from another model (e.g. task), the
order number was not being considered.

The technical reason for the above is the resulting domaing was like this:

    [
        '|',
        ('order_id.name', 'ilike', 'SO name'),
        ('name', 'ilike', 'SO name'),
        # The below line is added by _name_search of base model
        ('name', 'ilike', 'SO name'),
    ])

So, even though the order number is added to the domain, an extra
condition was forcing the line description to be the only field to be
considered.

closes odoo/odoo#83911

X-original-commit: b5d45d6cae3579970ed55bc65d52c2de2377c381
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Luis González
2022-02-03 15:22:09 +00:00
committed by Victor Feyens
parent b68cc2fc02
commit 8bf732f050
+1
View File
@@ -763,6 +763,7 @@ class SaleOrderLine(models.Model):
args or [],
['|', ('order_id.name', operator, name), ('name', operator, name)]
])
return self._search(args, limit=limit, access_rights_uid=name_get_uid)
return super(SaleOrderLine, self)._name_search(name, args=args, operator=operator, limit=limit, name_get_uid=name_get_uid)
def _check_line_unlink(self):