Consider tax deducible check in ReceivedInvoiceMapper.
This commit refs #23921
This commit is contained in:
parent
d952a9b8be
commit
f29fc68153
|
@ -458,6 +458,24 @@ class RecievedInvoiceMapper(BaseInvoiceMapper):
|
||||||
specialkey_or_trascendence = attrgetter('sii_received_key')
|
specialkey_or_trascendence = attrgetter('sii_received_key')
|
||||||
move_date = attrgetter('move.date')
|
move_date = attrgetter('move.date')
|
||||||
|
|
||||||
|
def get_tax_rate(self, tax):
|
||||||
|
if not tax.tax.deducible:
|
||||||
|
return 0.0
|
||||||
|
return tax.tax.rate
|
||||||
|
|
||||||
|
def get_tax_base(self, tax):
|
||||||
|
amount = super().get_tax_base(tax)
|
||||||
|
if not tax.tax.deducible:
|
||||||
|
amount += super().get_tax_amount(tax)
|
||||||
|
return amount
|
||||||
|
|
||||||
|
tax_rate = get_tax_rate
|
||||||
|
|
||||||
|
def get_tax_amount(self, tax):
|
||||||
|
if not tax.tax.deducible:
|
||||||
|
return Decimal('0.0')
|
||||||
|
return super().get_tax_amount(tax)
|
||||||
|
|
||||||
def _is_first_semester(self, invoice):
|
def _is_first_semester(self, invoice):
|
||||||
return self.specialkey_or_trascendence(invoice) == \
|
return self.specialkey_or_trascendence(invoice) == \
|
||||||
SEMESTER1_RECIEVED_SPECIALKEY
|
SEMESTER1_RECIEVED_SPECIALKEY
|
||||||
|
@ -536,11 +554,11 @@ class RecievedInvoiceMapper(BaseInvoiceMapper):
|
||||||
|
|
||||||
def build_taxes(self, invoice, tax):
|
def build_taxes(self, invoice, tax):
|
||||||
ret = {
|
ret = {
|
||||||
'BaseImponible': self.tax_base(tax),
|
'BaseImponible': self.get_tax_base(tax),
|
||||||
}
|
}
|
||||||
if self.specialkey_or_trascendence(invoice) != '02':
|
if self.specialkey_or_trascendence(invoice) != '02':
|
||||||
ret['TipoImpositivo'] = tools._rate_to_percent(self.tax_rate(tax))
|
ret['TipoImpositivo'] = tools._rate_to_percent(self.tax_rate(tax))
|
||||||
ret['CuotaSoportada'] = self.tax_amount(tax)
|
ret['CuotaSoportada'] = self.get_tax_amount(tax)
|
||||||
if self.tax_equivalence_surcharge_rate(tax):
|
if self.tax_equivalence_surcharge_rate(tax):
|
||||||
ret['TipoRecargoEquivalencia'] = \
|
ret['TipoRecargoEquivalencia'] = \
|
||||||
tools._rate_to_percent(self.tax_equivalence_surcharge_rate(
|
tools._rate_to_percent(self.tax_equivalence_surcharge_rate(
|
||||||
|
@ -555,5 +573,5 @@ class RecievedInvoiceMapper(BaseInvoiceMapper):
|
||||||
ret['PorcentCompensacionREAGYP'] = \
|
ret['PorcentCompensacionREAGYP'] = \
|
||||||
tools._rate_to_percent(self.tax_rate(tax))
|
tools._rate_to_percent(self.tax_rate(tax))
|
||||||
ret['ImporteCompensacionREAGYP'] = \
|
ret['ImporteCompensacionREAGYP'] = \
|
||||||
(self.tax_amount(tax))
|
(self.get_tax_amount(tax))
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in New Issue