diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/common.py b/addons/l10n_account_edi_ubl_cii_tests/tests/common.py index 1109706c9d3..bf0504f3a5b 100644 --- a/addons/l10n_account_edi_ubl_cii_tests/tests/common.py +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/common.py @@ -225,7 +225,7 @@ class TestUBLCommon(AccountTestInvoicingCommon): account_move._generate_pdf_and_send_invoice(self.move_template) return account_move - def _assert_invoice_attachment(self, attachment, xpaths, expected_file): + def _assert_invoice_attachment(self, attachment, xpaths, expected_file_path): """ Get attachment from a posted account.move, and asserts it's the same as the expected xml file. """ @@ -234,8 +234,9 @@ class TestUBLCommon(AccountTestInvoicingCommon): xml_content = base64.b64decode(attachment.with_context(bin_size=False).datas) xml_etree = self.get_xml_tree_from_string(xml_content) - expected_file_path = get_resource_path('l10n_account_edi_ubl_cii_tests', 'tests/test_files', expected_file) - expected_etree = etree.parse(expected_file_path).getroot() + expected_file = get_resource_path(self.test_module, 'tests/test_files', expected_file_path) + self.assertTrue(expected_file, "expected file not found") + expected_etree = etree.parse(expected_file).getroot() modified_etree = self.with_applied_xpath( expected_etree, diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_fr.py b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_fr.py index 6c40fa4103e..69c731f5ee5 100644 --- a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_fr.py +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_fr.py @@ -182,7 +182,7 @@ class TestCIIFR(TestUBLCommon): ___ignore___ ''', - expected_file='from_odoo/facturx_out_invoice.xml', + expected_file_path='from_odoo/facturx_out_invoice.xml', ) self.assertEqual(attachment.name, "factur-x.xml") self._assert_imported_invoice_from_etree(invoice, attachment) @@ -227,7 +227,7 @@ class TestCIIFR(TestUBLCommon): ___ignore___ ''', - expected_file='from_odoo/facturx_out_refund.xml' + expected_file_path='from_odoo/facturx_out_refund.xml' ) self.assertEqual(attachment.name, "factur-x.xml") self._assert_imported_invoice_from_etree(refund, attachment) @@ -280,7 +280,7 @@ class TestCIIFR(TestUBLCommon): ___ignore___ ''', - expected_file='from_odoo/facturx_out_invoice_tax_incl.xml' + expected_file_path='from_odoo/facturx_out_invoice_tax_incl.xml' ) def test_encoding_in_attachment_facturx(self): diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_au.py b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_au.py index 594d9a393bd..21d1c8a1bac 100644 --- a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_au.py +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_au.py @@ -109,7 +109,7 @@ class TestUBLAU(TestUBLCommon): {invoice.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/a_nz_out_invoice.xml', + expected_file_path='from_odoo/a_nz_out_invoice.xml', ) self.assertEqual(attachment.name[-8:], "a_nz.xml") self._assert_imported_invoice_from_etree(invoice, attachment) @@ -167,7 +167,7 @@ class TestUBLAU(TestUBLCommon): {refund.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/a_nz_out_refund.xml', + expected_file_path='from_odoo/a_nz_out_refund.xml', ) self.assertEqual(attachment.name[-8:], "a_nz.xml") self._assert_imported_invoice_from_etree(refund, attachment) diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py index ad675079684..bf66d37ff82 100644 --- a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py @@ -139,7 +139,7 @@ class TestUBLBE(TestUBLCommon, TestAccountMoveSendCommon): {invoice.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/bis3_out_invoice.xml', + expected_file_path='from_odoo/bis3_out_invoice.xml', ) self.assertEqual(attachment.name[-12:], "ubl_bis3.xml") self._assert_imported_invoice_from_etree(invoice, attachment) @@ -197,7 +197,7 @@ class TestUBLBE(TestUBLCommon, TestAccountMoveSendCommon): {refund.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/bis3_out_refund.xml', + expected_file_path='from_odoo/bis3_out_refund.xml', ) self.assertEqual(attachment.name[-12:], "ubl_bis3.xml") self._assert_imported_invoice_from_etree(refund, attachment) @@ -252,7 +252,7 @@ class TestUBLBE(TestUBLCommon, TestAccountMoveSendCommon): {invoice.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/bis3_out_invoice_public_admin.xml', + expected_file_path='from_odoo/bis3_out_invoice_public_admin.xml', ) def test_rounding_price_unit(self): diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_de.py b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_de.py index e21ebd24d60..9adc376ed1a 100644 --- a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_de.py +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_de.py @@ -121,7 +121,7 @@ class TestUBLDE(TestUBLCommon): {invoice.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/xrechnung_ubl_out_invoice.xml', + expected_file_path='from_odoo/xrechnung_ubl_out_invoice.xml', ) self.assertEqual(attachment.name[-10:], "ubl_de.xml") self._assert_imported_invoice_from_etree(invoice, attachment) @@ -179,7 +179,7 @@ class TestUBLDE(TestUBLCommon): {refund.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/xrechnung_ubl_out_refund.xml', + expected_file_path='from_odoo/xrechnung_ubl_out_refund.xml', ) self.assertEqual(attachment.name[-10:], "ubl_de.xml") self._assert_imported_invoice_from_etree(refund, attachment) diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_nl.py b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_nl.py index f01c5fb9900..784753fe5fb 100644 --- a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_nl.py +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_nl.py @@ -138,7 +138,7 @@ class TestUBLNL(TestUBLCommon): {invoice.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/nlcius_out_invoice.xml', + expected_file_path='from_odoo/nlcius_out_invoice.xml', ) self.assertEqual(attachment.name[-10:], "nlcius.xml") self._assert_imported_invoice_from_etree(invoice, attachment) @@ -196,7 +196,7 @@ class TestUBLNL(TestUBLCommon): {refund.invoice_pdf_report_id.name} ''', - expected_file='from_odoo/nlcius_out_refund.xml', + expected_file_path='from_odoo/nlcius_out_refund.xml', ) self.assertEqual(attachment.name[-10:], "nlcius.xml") self._assert_imported_invoice_from_etree(refund, attachment)