Skip to content
Snippets Groups Projects
Commit 4ed6527c authored by Ivan Yelizariev's avatar Ivan Yelizariev
Browse files

[FIX] sale: fix search "invoices is not set" for sale.order


BEFORE this commit query "invoices is not set" was tranformed to
query "order_line.invoice_lines.invoice_id is False", which doesn't make sense,
because invoice_id is required fields and hence always set. Hence, result of
the query was always empty.

AFTER: just check that there is no invoice_lines. Strictly speacking, is not the
same as checking result of compute method, but because invoice_lines are
supposed to be lines for invoices of out_* type, the result should be the same.

---

opw-2516124

closes odoo/odoo#70493

X-original-commit: 540b45cc
Signed-off-by: default avatarIvan Yelizariev // IEL <yelizariev@users.noreply.github.com>
parent 87964726
No related branches found
No related tags found
No related merge requests found
......@@ -138,6 +138,8 @@ class SaleOrder(models.Model):
""", (list(value),))
so_ids = self.env.cr.fetchone()[0] or []
return [('id', 'in', so_ids)]
if operator == '=' and not value:
return [('order_line.invoice_lines', '=', False)]
return ['&', ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)]
name = fields.Char(string='Order Reference', required=True, copy=False, readonly=True, states={'draft': [('readonly', False)]}, index=True, default=lambda self: _('New'))
......
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