This commit is contained in:
Alnus Tmp 2021-10-14 03:36:26 +00:00
parent 096ff281cf
commit 9eeef4bdc4
1 changed files with 8 additions and 4 deletions

View File

@ -5,6 +5,7 @@ from trytond.modules.product import price_digits
from trytond.transaction import Transaction
from trytond.pyson import If, Eval, Bool
from trytond.exceptions import UserError
from trytond.modules.account.tax import TaxableMixin
class InvoiceLine(metaclass=PoolMeta):
@ -38,6 +39,7 @@ class InvoiceLine(metaclass=PoolMeta):
else:
invoice_type = getattr(self, 'invoice_type', None)
if invoice_type == 'in':
unit_price = 'unit_price'
if context.get('_deductible_rate') is not None:
deductible_rate = context['_deductible_rate']
else:
@ -48,9 +50,11 @@ class InvoiceLine(metaclass=PoolMeta):
return []
else:
deductible_rate = 1
unit_price = 'unit_price_days'
return [(
getattr(self, 'taxes', None) or [],
((getattr(self, 'unit_price_days', None) or Decimal(0))
((getattr(self, unit_price, None) or Decimal(0))
* deductible_rate),
getattr(self, 'quantity', None) or 0,
getattr(self, 'tax_date', None),