Use 1 as value when taxes_deductible_rate is None

issue10453
review353561002
(grafted from cfe4f7653a5b553c174c3bf426579fe32cb2d51a)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2021-05-26 23:52:30 +02:00
1 parent 259c119fbf
commit 03b10b4666
1 file changed
+5 -1
+5 -1
View File
@@ -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: