diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py b/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py index f168fec8d0b..95f04deb12a 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py @@ -18,7 +18,7 @@ class AccountEdiXmlCII(models.AbstractModel): _description = "Factur-x/XRechnung CII 2.2.0" def _export_invoice_filename(self, invoice): - return "factur-x.xml" + return f"{invoice.name.replace('/', '_')}_factur_x.xml" def _export_invoice_ecosio_schematrons(self): return { 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 69c731f5ee5..48395dc920c 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 @@ -137,7 +137,8 @@ class TestCIIFR(TestUBLCommon): ) pdf_attachment = invoice.ubl_cii_xml_id - self.assertEqual(pdf_attachment['name'], 'factur-x.xml') + facturx_filename = self.env['account.edi.xml.cii']._export_invoice_filename(invoice) + self.assertEqual(pdf_attachment['name'], facturx_filename) def test_export_import_invoice(self): invoice = self._generate_move( @@ -184,7 +185,8 @@ class TestCIIFR(TestUBLCommon): ''', expected_file_path='from_odoo/facturx_out_invoice.xml', ) - self.assertEqual(attachment.name, "factur-x.xml") + facturx_filename = self.env['account.edi.xml.cii']._export_invoice_filename(invoice) + self.assertEqual(attachment.name, facturx_filename) self._assert_imported_invoice_from_etree(invoice, attachment) def test_export_import_refund(self): @@ -229,7 +231,8 @@ class TestCIIFR(TestUBLCommon): ''', expected_file_path='from_odoo/facturx_out_refund.xml' ) - self.assertEqual(attachment.name, "factur-x.xml") + facturx_filename = self.env['account.edi.xml.cii']._export_invoice_filename(refund) + self.assertEqual(attachment.name, facturx_filename) self._assert_imported_invoice_from_etree(refund, attachment) def test_export_tax_included(self): @@ -290,7 +293,8 @@ class TestCIIFR(TestUBLCommon): move_type='out_invoice', invoice_line_ids=[{'product_id': self.product_a.id}], ) - self._test_encoding_in_attachment(invoice.ubl_cii_xml_id, 'factur-x.xml') + facturx_filename = self.env['account.edi.xml.cii']._export_invoice_filename(invoice) + self._test_encoding_in_attachment(invoice.ubl_cii_xml_id, facturx_filename) def test_export_with_fixed_taxes_case1(self): # CASE 1: simple invoice with a recupel tax