[IMP] l10n_es_edi_sii: clearer missing element TipoDesglose error
When sending an invoice to the SII edi, the field TipoDesglose is required. In case we have a foreign customer outside of Spain, we are filtering the taxes information based on the tax scope (services or goods). In case the tax scope is not filled in, TipoDesglose is not provided and this will cause the request to fail, with no clear reason for the user. We should add an UserError message to make it clear enough so the user can fix it himself. closes odoo/odoo#95164 X-original-commit: 7a6b3544d7c3a855489a0d5f7075691e25264e2d Signed-off-by: Florian Gilbert (flg) <flg@odoo.com> Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
This commit is contained in:
@@ -6,6 +6,7 @@ from OpenSSL.crypto import load_certificate, load_privatekey, FILETYPE_PEM
|
||||
from zeep.transports import Transport
|
||||
|
||||
from odoo import fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import html_escape
|
||||
|
||||
import math
|
||||
@@ -348,6 +349,11 @@ class AccountEdiFormat(models.Model):
|
||||
invoice_node.setdefault('TipoDesglose', {})
|
||||
invoice_node['TipoDesglose'].setdefault('DesgloseTipoOperacion', {})
|
||||
invoice_node['TipoDesglose']['DesgloseTipoOperacion']['Entrega'] = tax_details_info_consu_vals['tax_details_info']
|
||||
if not invoice_node.get('TipoDesglose'):
|
||||
raise UserError(_(
|
||||
"In case of a foreign customer, you need to configure the tax scope on taxes:\n%s",
|
||||
"\n".join(invoice.line_ids.tax_ids.mapped('name'))
|
||||
))
|
||||
|
||||
invoice_node['ImporteTotal'] = round(sign * (
|
||||
tax_details_info_service_vals['tax_details']['base_amount']
|
||||
|
||||
Reference in New Issue
Block a user