summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2015-12-22 15:08:15 +0100
committerDamien Bouvy <dbo@odoo.com>2015-12-23 11:51:48 +0100
commited6a52a5177349d41f2a589596d9ddfc312b8dff (patch)
treef0a735f7d24300b3890e0306ca055ccbf46738f1
parentc7337bf3b309768e9dd67d0bf65a5dce826b3fd5 (diff)
[FIX] sale: no more refund invoices overload
When fetching the invoices linked to a sales order, the system looked for all refunds which had an 'origin' field that was the number of an invoice of this SO. That's nice, except that invoices that are not yet validated do not have a number, which caused sales order with an uncofirmed invoices to be 'linked' to all 'out_invoices' that had no origin (which could be 1000+ for a substantial db) (basically all out invoices which had the origin field set to false) This commit simply extends the domain to exclude refunds that did not originate explicitly from one of the SO's invoices.
-rw-r--r--addons/sale/sale.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 1525429904a..bfaea2e26d0 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -55,7 +55,7 @@ class SaleOrder(models.Model):
# Search for refunds as well
refund_ids = self.env['account.invoice'].browse()
if invoice_ids:
- refund_ids = refund_ids.search([('type', '=', 'out_refund'), ('origin', 'in', invoice_ids.mapped('number'))])
+ refund_ids = refund_ids.search([('type', '=', 'out_refund'), ('origin', 'in', invoice_ids.mapped('number')), ('origin', '!=', False)])
line_invoice_status = [line.invoice_status for line in order.order_line]