From 604b6eebd0265b518d19df3bce14e2ddb560b6ad Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Wed, 1 Mar 2017 09:58:30 +0100 Subject: [PATCH] Skip lines without product to determine if invoice is credit_note Also don't consider lines with zero amount as credit notes issue6253 review35261002 --- invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/invoice.py b/invoice.py index aeccc4bda9..fe7a25ff05 100644 --- a/invoice.py +++ b/invoice.py @@ -1008,7 +1008,8 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): date=accounting_date, test_state=test_state) period = Period(period_id) invoice_type = invoice.type - if all(l.amount <= 0 for l in invoice.lines): + if (all(l.amount < 0 for l in invoice.lines if l.product) + and invoice.total_amount < 0): invoice_type += '_credit_note' else: invoice_type += '_invoice'