[FIX] l10n_sa_edi: adapt code with new structure of field 'display_type'
Currently, errors occur when generating the e-invoicing for ZATCA (Saudi Arabia). This is because currently, users create invoices without a tax, but in Saudi Arabia, the invoice line must require at least one tax. The validation error is present at Line [1], but due to recent changes in Code [1], the validation is not working. As a result, the user can create an invoice line without tax. see https://github.com/odoo/odoo/pull/130034. This commit fixes the above issue by filtering invlocice line ids that have display_type 'product'. Line [1]-https://github.com/odoo/odoo/blob/d2f0a0f2c9a18a7a6cef8ca3be52324ad2a1dad6/addons/l10n_sa_edi/models/account_edi_format.py#L406 Code [1] odoo@d8d47f9#diff-78f3e1847de8ca0acf28d72a412947a549acdb08142d1dadf7646363d7972cb0R268-R280 sentry-4467808485, 4467794808 closes odoo/odoo#136568 X-original-commit: 6ee82c26483fabd7962ff4f421924c7330f9b70c Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com> Signed-off-by: ANSARI MAHAMADASIF (maan) <maan@odoo.com>
This commit is contained in:
@@ -281,7 +281,7 @@ class AccountEdiFormat(models.Model):
|
||||
fields_to_check = []
|
||||
if any(tax.l10n_sa_exemption_reason_code in ('VATEX-SA-HEA', 'VATEX-SA-EDU') for tax in
|
||||
invoice.invoice_line_ids.filtered(
|
||||
lambda line: not line.display_type).tax_ids):
|
||||
lambda line: line.display_type == 'product').tax_ids):
|
||||
fields_to_check += [
|
||||
('l10n_sa_additional_identification_scheme',
|
||||
_('Additional Identification Scheme is required for the Buyer if tax exemption reason is either '
|
||||
@@ -403,7 +403,7 @@ class AccountEdiFormat(models.Model):
|
||||
if invoice.commercial_partner_id == invoice.company_id.partner_id.commercial_partner_id:
|
||||
errors.append(_("- You cannot post invoices where the Seller is the Buyer"))
|
||||
|
||||
if not all(line.tax_ids for line in invoice.invoice_line_ids.filtered(lambda line: not line.display_type)):
|
||||
if not all(line.tax_ids for line in invoice.invoice_line_ids.filtered(lambda line: line.display_type == 'product')):
|
||||
errors.append(_("- Invoice lines should have at least one Tax applied."))
|
||||
|
||||
if not journal._l10n_sa_ready_to_submit_einvoices():
|
||||
|
||||
Reference in New Issue
Block a user