From 4d2c7903f6fce442cc9afa7f981d6e6af908fc3c Mon Sep 17 00:00:00 2001 From: "Benjamin Frantzen (bfr)" Date: Tue, 11 May 2021 13:32:18 +0000 Subject: [PATCH] [REF] account_edi_ubl, l10n_nl_edi: removed unnecessary code and small refactor of how errors are handled - Overriding '_is_embedding_to_invoice_pdf_needed' is unnecessary since the default value is already 'False'. - When calling '_check_move_configuration', we should not ignore the errors returned by 'super' --- addons/account_edi_ubl/models/account_edi_format.py | 7 ------- addons/l10n_nl_edi/models/account_edi_format.py | 12 ++---------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/addons/account_edi_ubl/models/account_edi_format.py b/addons/account_edi_ubl/models/account_edi_format.py index 00988998461..6e3182e82a8 100644 --- a/addons/account_edi_ubl/models/account_edi_format.py +++ b/addons/account_edi_ubl/models/account_edi_format.py @@ -259,10 +259,3 @@ class AccountEdiFormat(models.Model): attachment = self._export_ubl(invoice) res[invoice] = {'success': True, 'attachment': attachment} return res - - def _is_embedding_to_invoice_pdf_needed(self): - # OVERRIDE - self.ensure_one() - if self.code != 'ubl_2_1': - return super()._is_embedding_to_invoice_pdf_needed() - return False # ubl must not be embedded to PDF. diff --git a/addons/l10n_nl_edi/models/account_edi_format.py b/addons/l10n_nl_edi/models/account_edi_format.py index f041e5812d9..23d11b8329b 100644 --- a/addons/l10n_nl_edi/models/account_edi_format.py +++ b/addons/l10n_nl_edi/models/account_edi_format.py @@ -83,11 +83,9 @@ class AccountEdiFormat(models.Model): #################################################### def _check_move_configuration(self, invoice): - res = super()._check_move_configuration(invoice) + errors = super()._check_move_configuration(invoice) if self.code != 'nlcius_1': - return res - - errors = [] + return errors supplier = invoice.company_id.partner_id.commercial_partner_id if not supplier.street or not supplier.zip or not supplier.city: @@ -130,12 +128,6 @@ class AccountEdiFormat(models.Model): attachment = self._export_nlcius(invoice) return {invoice: {'success': True, 'attachment': attachment}} - def _is_embedding_to_invoice_pdf_needed(self): - self.ensure_one() - if self.code != 'nlcius_1': - return super()._is_embedding_to_invoice_pdf_needed() - return False - def _create_invoice_from_xml_tree(self, filename, tree): self.ensure_one() if self.code == 'nlcius_1' and self._is_nlcius(filename, tree):