From 74e321f32cd538fb55431f3c85a28fd6f458dd8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 2 Aug 2020 23:56:32 +0200 Subject: [PATCH] Do not set unit price or quantity if empty The unit price or the quantity of the credit note line should not be updated if the value from the complain invoice line is None as it means we must use the original one. issue9497 review290651002 --- complaint.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/complaint.py b/complaint.py index 04041ffacb..81b97e4415 100644 --- a/complaint.py +++ b/complaint.py @@ -498,9 +498,11 @@ class Action(ModelSQL, ModelView): if self.invoice_lines: invoice_lines = [l.line for l in self.invoice_lines] line2qty = {l.line: l.quantity - for l in self.invoice_lines} + for l in self.invoice_lines + if l.quantity is not None} line2price = {l.line: l.unit_price - for l in self.invoice_lines} + for l in self.invoice_lines + if l.unit_price is not None} else: invoice_lines = invoice.lines elif isinstance(self.complaint.origin, Line):