Added get_tax_amount and get_tax_base to base mapper class.
This commit is contained in:
parent
7bef904ee6
commit
610044193c
|
@ -56,11 +56,11 @@ class BaseTrytonInvoiceMapper(Model):
|
|||
total = 0
|
||||
taxes_used = {}
|
||||
for tax in taxes:
|
||||
base = tax.company_base
|
||||
base = self.get_tax_base(tax)
|
||||
parent = tax.tax.parent if tax.tax.parent else tax.tax
|
||||
if parent.id in list(taxes_used.keys()) and base == taxes_used[parent.id]:
|
||||
continue
|
||||
total += (base + tax.company_amount)
|
||||
total += (base + self.get_tax_amount(tax))
|
||||
taxes_used[parent.id] = base
|
||||
return total
|
||||
|
||||
|
@ -69,8 +69,17 @@ class BaseTrytonInvoiceMapper(Model):
|
|||
untaxed_amount = get_invoice_untaxed
|
||||
total_amount = get_invoice_total
|
||||
tax_rate = attrgetter('tax.rate')
|
||||
tax_base = attrgetter('company_base')
|
||||
tax_amount = attrgetter('company_amount')
|
||||
|
||||
def get_tax_amount(self, tax):
|
||||
val = attrgetter('company_amount')(tax)
|
||||
return val
|
||||
|
||||
def get_tax_base(self, tax):
|
||||
val = attrgetter('company_base')(tax)
|
||||
return val
|
||||
|
||||
tax_base = get_tax_base
|
||||
tax_amount = get_tax_amount
|
||||
|
||||
def counterpart_name(self, invoice):
|
||||
return tools.unaccent(invoice.party.name)
|
||||
|
|
Loading…
Reference in New Issue