From 03b10b4666d02ea04106b6f7b5d6987225df7e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 26 May 2021 23:52:30 +0200 Subject: [PATCH] Use 1 as value when taxes_deductible_rate is None issue10453 review353561002 (grafted from cfe4f7653a5b553c174c3bf426579fe32cb2d51a) --HG-- branch : 6.0 --- invoice.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/invoice.py b/invoice.py index 87d625853f..ffb231f634 100644 --- a/invoice.py +++ b/invoice.py @@ -2022,7 +2022,9 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): * (self.unit_price or Decimal('0.0'))) invoice_type = ( self.invoice.type if self.invoice else self.invoice_type) - if invoice_type == 'in' and self.taxes_deductible_rate != 1: + if (invoice_type == 'in' + and self.taxes_deductible_rate is not None + and self.taxes_deductible_rate != 1): with Transaction().set_context(_deductible_rate=1): tax_amount = sum( t['amount'] for t in self._get_taxes().values()) @@ -2075,6 +2077,8 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): deductible_rate = context['_deductible_rate'] else: deductible_rate = getattr(self, 'taxes_deductible_rate', 1) + if deductible_rate is None: + deductible_rate = 1 if not deductible_rate: return [] else: