[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
This commit is contained in:
Nicolas Martinelli
2017-04-12 11:08:40 +02:00
parent c5f2200a76
commit 65cd9269b4
+3 -1
View File
@@ -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'