Skip to content

Commit

Permalink
[FIX] l10n_es_aeat_sii_oca: Campo BaseImponibleACoste obligatorio con…
Browse files Browse the repository at this point in the history
… ^ClaveRegimenEspecialOTrascendencia.*$ = '06'
  • Loading branch information
eantones committed May 17, 2022
1 parent c498d36 commit ce47a8c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions l10n_es_aeat_sii_oca/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,10 @@ def _is_sii_simplified_invoice(self):
is_simplified = partner.sii_simplified_invoice
return is_simplified

def _get_sii_base_cost(self):
self.ensure_one()
return sum([x["base"] for x in self._get_tax_info().values()])

def _sii_check_exceptions(self):
"""Inheritable method for exceptions control when sending SII invoices."""
self.ensure_one()
Expand Down Expand Up @@ -856,6 +860,14 @@ def _get_sii_invoice_dict_out(self, cancel=False):
)
}
)
if "06" in [
self.sii_registration_key.code,
self.sii_registration_key_additional1.code,
self.sii_registration_key_additional2.code,
]:
inv_dict["FacturaExpedida"].update(
{"BaseImponibleACoste": self._get_sii_base_cost()}
)
if self.sii_registration_key.code in ["12", "13"]:
inv_dict["FacturaExpedida"]["DatosInmueble"] = {
"DetalleInmueble": {
Expand Down Expand Up @@ -946,6 +958,14 @@ def _get_sii_invoice_dict_in(self, cancel=False):
)
}
)
if "06" in [
self.sii_registration_key.code,
self.sii_registration_key_additional1.code,
self.sii_registration_key_additional2.code,
]:
inv_dict["FacturaRecibida"].update(
{"BaseImponibleACoste": self._get_sii_base_cost()}
)
# Uso condicional de IDOtro/NIF
inv_dict["FacturaRecibida"]["Contraparte"].update(ident)
if self.move_type == "in_refund":
Expand Down Expand Up @@ -984,6 +1004,7 @@ def _get_sii_invoice_dict(self):
"CuotaRectificada",
"CuotaDeducible",
"ImporteCompensacionREAGYP",
"BaseImponibleACoste",
],
)
return inv_dict
Expand Down

0 comments on commit ce47a8c

Please sign in to comment.