[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'
This commit is contained in:
Benjamin Frantzen (bfr)
2021-08-17 08:21:57 +00:00
parent cdd920a113
commit 4d2c7903f6
2 changed files with 2 additions and 17 deletions
@@ -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.
@@ -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):