Change amount getter in mapping to use the company amounts values introduced with the dependency of the account_invoice_company_currency module. Update scenario too

This commit is contained in:
Bernat Brunet Torruella 2018-05-31 15:32:04 +02:00
parent cb485e964b
commit d564144d51
2 changed files with 7 additions and 6 deletions

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from decimal import Decimal
from logging import getLogger
from operator import attrgetter
from decimal import Decimal
from pyAEATsii import mapping
from pyAEATsii import callback_utils
@ -47,11 +47,11 @@ class BaseTrytonInvoiceMapper(Model):
counterpart_id_type = attrgetter('party.sii_identifier_type')
counterpart_id = counterpart_nif
untaxed_amount = attrgetter('untaxed_amount')
total_amount = attrgetter('total_amount')
untaxed_amount = attrgetter('company_untaxed_amount')
total_amount = attrgetter('company_total_amount')
tax_rate = attrgetter('tax.rate')
tax_base = attrgetter('base')
tax_amount = attrgetter('amount')
tax_base = attrgetter('company_base')
tax_amount = attrgetter('company_amount')
def counterpart_name(self, invoice):
return tools.unaccent(invoice.party.name)
@ -140,7 +140,7 @@ class RecievedTrytonInvoiceMapper(mapping.RecievedInvoiceMapper,
def deductible_amount(self, invoice):
val = Decimal(0)
for tax in self.taxes(invoice):
val += tax.amount
val += tax.company_amount
return val
tax_reagyp_rate = BaseTrytonInvoiceMapper.tax_rate

View File

@ -2,6 +2,7 @@
version=4.0.0
depends:
account_invoice
account_invoice_company_currency
extras_depend:
account_es
account_es_pyme