From 65cd9269b4166401339c012bb9f76d406f223596 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 12 Apr 2017 10:12:57 +0200 Subject: [PATCH] [FIX] sale: invoice status - Create a product invoiced at delivery (A) - Create a SO with Product A, confirm => the invoicing status is "Nothing to invoice" - Create a down payment => the invoicing status is "To Invoice" Since the down payment is added as a product, its invoicing status influences the global invoicing status of the SO, while it shouldn't. opw-727936 --- addons/sale/models/sale.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 61f17bb2b9b..911189102db 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -67,7 +67,9 @@ class SaleOrder(models.Model): for inv in invoice_ids: refund_ids += refund_ids.search([('type', '=', 'out_refund'), ('origin', '=', inv.number), ('origin', '!=', False), ('journal_id', '=', inv.journal_id.id)]) - line_invoice_status = [line.invoice_status for line in order.order_line] + # Ignore the status of the deposit product + deposit_product_id = self.env['sale.advance.payment.inv']._default_product_id() + line_invoice_status = [line.invoice_status for line in order.order_line if line.product_id != deposit_product_id] if order.state not in ('sale', 'done'): invoice_status = 'no'