From c25f8d94e52c620435effa214edb193c8252dbd9 Mon Sep 17 00:00:00 2001 From: Julien Van Roy Date: Wed, 22 Jun 2022 11:50:11 +0000 Subject: [PATCH] [FIX] account_edi_ubl_cii: fix edi options on journal We only want the edi.format options to appear on the sale journals (out_invoice, out_refund). In addition, the warnings are no longer displayed on top of the invoice. closes odoo/odoo#94376 X-original-commit: dca5a2844ef2e90c257b78add3e147b291a9fa18 Signed-off-by: Laurent Smet Signed-off-by: Julien Van Roy --- .../account_edi_ubl_cii/models/account_edi_format.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/addons/account_edi_ubl_cii/models/account_edi_format.py b/addons/account_edi_ubl_cii/models/account_edi_format.py index 353e266c452..0bbf5c89d85 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_format.py +++ b/addons/account_edi_ubl_cii/models/account_edi_format.py @@ -88,7 +88,7 @@ class AccountEdiFormat(models.Model): self.ensure_one() if self.code not in FORMAT_CODES: return super()._is_compatible_with_journal(journal) - return self._is_ubl_cii_available(journal.company_id) + return self._is_ubl_cii_available(journal.company_id) and journal.type == 'sale' def _is_enabled_by_default_on_journal(self, journal): # EXTENDS account_edi @@ -108,6 +108,7 @@ class AccountEdiFormat(models.Model): res = {} for invoice in invoices: builder = self._get_xml_builder(invoice.company_id) + # For now, the errors are not displayed anywhere, don't want to annoy the user xml_content, errors = builder._export_invoice(invoice) # DEBUG: send directly to the test platform (the one used by ecosio) @@ -128,14 +129,6 @@ class AccountEdiFormat(models.Model): 'success': True, 'attachment': attachment, } - if errors: - res[invoice].update({ - 'success': False, - 'error': _("Errors occured while creating the EDI document (format: %s). The receiver " - "might refuse it.", builder._description) - + '

  • ' + "
  • ".join(errors) + '
  • ', - 'blocking_level': 'info', - }) return res