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

View file

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