Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.0][FIX] l10n-spain: campo BaseImponibleACoste obligatorio con ^ClaveReg… #1210

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions l10n_es_aeat_sii/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,14 @@ def _get_sii_in_taxes(self):
)
return taxes_dict, tax_amount

@api.multi
def _get_sii_base_cost(self):
self.ensure_one()
return sum(
self.tax_line_ids.filtered(
lambda x: not x.tax_id.include_base_amount).mapped('base')
)

@api.multi
def _sii_check_exceptions(self):
"""Inheritable method for exceptions control when sending SII invoices.
Expand Down Expand Up @@ -762,6 +770,14 @@ def _get_sii_invoice_dict_out(self, cancel=False):
inv_dict["FacturaExpedida"].\
update({'ClaveRegimenEspecialOTrascendenciaAdicional2': (
self.sii_registration_key_additional2.code)})
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': abs(
self._get_sii_base_cost()
) * sign
})
if self.sii_registration_key.code in ['12', '13']:
inv_dict["FacturaExpedida"]['DatosInmueble'] = {
'DetalleInmueble': {
Expand Down Expand Up @@ -862,6 +878,14 @@ def _get_sii_invoice_dict_in(self, cancel=False):
inv_dict["FacturaRecibida"].\
update({'ClaveRegimenEspecialOTrascendenciaAdicional2': (
self.sii_registration_key_additional2.code)})
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': abs(
self._get_sii_base_cost()
) * sign
})
# Uso condicional de IDOtro/NIF
inv_dict['FacturaRecibida']['Contraparte'].update(ident)
if self.type == 'in_refund':
Expand Down Expand Up @@ -902,6 +926,7 @@ def _get_sii_invoice_dict(self):
'CuotaRectificada',
'CuotaDeducible',
'ImporteCompensacionREAGYP',
'BaseImponibleACoste',
],
)
return inv_dict
Expand Down