[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#70526 X-original-commit: 4ed6527cb414ee11d9bfac43a78dcc68ce233d07 Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
This commit is contained in:
@@ -141,6 +141,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'))
|
||||
|
||||
Reference in New Issue
Block a user