diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/README.md b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/README.md index 8269af8..fd52227 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/README.md +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/README.md @@ -1,18 +1,18 @@ # Testing the Import/Export invoices with UBL/CII - This module tests the module 'account_edi_ubl_cii', it is separated since dependencies to some - localizations were required. Its name begins with 'l10n' to not overload runbot. - - The test files are separated by sources, they were taken from: - - * the factur-x doc (form the FNFE) - * the peppol-bis-invoice-3 doc (the github repository: https://github.com/OpenPEPPOL/peppol-bis-invoice-3/tree/master/rules/examples contains examples) - * odoo, these files pass all validation tests (using ecosio or the FNFE validator) - - We test that the external examples are correctly imported (currency, total amount and total tax match). - We also test that generating xml from odoo with given parameters gives exactly the same xml as the expected, - valid ones. +This module tests the module 'account_edi_ubl_cii', it is separated since dependencies to some +localizations were required. Its name begins with 'l10n' to not overload runbot. + +The test files are separated by sources, they were taken from: + +* the factur-x doc (form the FNFE) +* the peppol-bis-invoice-3 doc (the github repository: https://github.com/OpenPEPPOL/peppol-bis-invoice-3/tree/master/rules/examples contains examples) +* odoo, these files pass all validation tests (using ecosio or the FNFE validator) + +We test that the external examples are correctly imported (currency, total amount and total tax match). +We also test that generating xml from odoo with given parameters gives exactly the same xml as the expected, +valid ones. ## Installation @@ -23,41 +23,19 @@ pip install odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests ## Dependencies -This addon depends on: -- l10n_generic_coa - account_edi_ubl_cii -- l10n_fr +- l10n_fr_account - l10n_be - l10n_de - l10n_nl - l10n_au -## Manifest Information - -- **Name**: Testing the Import/Export invoices with UBL/CII -- **Version**: 1.0 -- **Category**: Hidden/Tests -- **License**: LGPL-3 -- **Installable**: True - ## Source -Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `l10n_account_edi_ubl_cii_tests`. +- Repository: https://github.com/OCA/OCB +- Branch: 19.0 +- Path: addons/l10n_account_edi_ubl_cii_tests ## License -This package maintains the original LGPL-3 license from the upstream Odoo project. - -## Documentation - -- Overview: doc/OVERVIEW.md -- Architecture: doc/ARCHITECTURE.md -- Models: doc/MODELS.md -- Controllers: doc/CONTROLLERS.md -- Wizards: doc/WIZARDS.md -- Install: doc/INSTALL.md -- Usage: doc/USAGE.md -- Configuration: doc/CONFIGURATION.md -- Dependencies: doc/DEPENDENCIES.md -- Troubleshooting: doc/TROUBLESHOOTING.md -- FAQ: doc/FAQ.md +This package preserves the original LGPL-3 license. diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/__manifest__.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/__manifest__.py index 9459029..caa6908 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/__manifest__.py +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/__manifest__.py @@ -2,32 +2,30 @@ { 'name': "Testing the Import/Export invoices with UBL/CII", 'version': '1.0', - 'category': 'Hidden/Tests', + 'category': 'Accounting/Accounting', 'description': """ - This module tests the module 'account_edi_ubl_cii', it is separated since dependencies to some - localizations were required. Its name begins with 'l10n' to not overload runbot. - - The test files are separated by sources, they were taken from: - - * the factur-x doc (form the FNFE) - * the peppol-bis-invoice-3 doc (the github repository: https://github.com/OpenPEPPOL/peppol-bis-invoice-3/tree/master/rules/examples contains examples) - * odoo, these files pass all validation tests (using ecosio or the FNFE validator) - - We test that the external examples are correctly imported (currency, total amount and total tax match). - We also test that generating xml from odoo with given parameters gives exactly the same xml as the expected, - valid ones. +This module tests the module 'account_edi_ubl_cii', it is separated since dependencies to some +localizations were required. Its name begins with 'l10n' to not overload runbot. + +The test files are separated by sources, they were taken from: + +* the factur-x doc (form the FNFE) +* the peppol-bis-invoice-3 doc (the github repository: https://github.com/OpenPEPPOL/peppol-bis-invoice-3/tree/master/rules/examples contains examples) +* odoo, these files pass all validation tests (using ecosio or the FNFE validator) + +We test that the external examples are correctly imported (currency, total amount and total tax match). +We also test that generating xml from odoo with given parameters gives exactly the same xml as the expected, +valid ones. """, 'depends': [ - 'l10n_generic_coa', 'account_edi_ubl_cii', - 'l10n_fr', + 'l10n_fr_account', 'l10n_be', 'l10n_de', 'l10n_nl', 'l10n_au', ], 'installable': True, - 'application': False, - 'auto_install': False, + 'author': 'Odoo S.A.', 'license': 'LGPL-3', } diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/__init__.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/__init__.py index 4e29fea..7cd39ef 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/__init__.py +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/__init__.py @@ -6,3 +6,5 @@ from . import test_xml_cii_fr from . import test_xml_cii_us from . import test_xml_ubl_nl from . import test_xml_ubl_au +from . import test_xml_ubl_sg +from . import test_xml_ubl_attacheddocument diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/common.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/common.py index c473f1d..91f373b 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/common.py +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/common.py @@ -2,34 +2,43 @@ import base64 from freezegun import freeze_time -from collections import Counter +from os.path import join as opj -from odoo.addons.account_edi.tests.common import AccountEdiTestCommon +from odoo.addons.account.tests.common import AccountTestInvoicingCommon from odoo import fields -from odoo.modules.module import get_resource_path -from odoo.tests import tagged +from odoo.tools import misc + from lxml import etree -class TestUBLCommon(AccountEdiTestCommon): +class TestUBLCommon(AccountTestInvoicingCommon): @classmethod - def setUpClass(cls, chart_template_ref=None, edi_format_ref=None): - super().setUpClass(chart_template_ref=chart_template_ref, edi_format_ref=edi_format_ref) + def setUpClass(cls): + super().setUpClass() + + cls.other_currency = cls.setup_other_currency('USD') # Required for `product_uom_id` to be visible in the form views - cls.env.user.groups_id += cls.env.ref('uom.group_uom') - - # Ensure the testing currency is using a valid ISO code. - real_usd = cls.env.ref('base.USD') - real_usd.name = 'FUSD' - real_usd.flush_model(['name']) - cls.currency_data['currency'].name = 'USD' + cls.env.user.group_ids += cls.env.ref('uom.group_uom') # remove this tax, otherwise, at import, this tax with children taxes can be selected and the total is wrong cls.tax_armageddon.children_tax_ids.unlink() cls.tax_armageddon.unlink() + cls.move_template = cls.env['mail.template'].create({ + 'auto_delete': True, + 'body_html': '

TemplateBody for

', + 'description': 'Sent to customers with their invoices in attachment', + 'email_from': "{{ (object.invoice_user_id.email_formatted or user.email_formatted) }}", + 'model_id': cls.env['ir.model']._get_id('account.move'), + 'name': "Invoice: Test Sending", + 'partner_to': "{{ object.partner_id.id }}", + 'subject': "{{ object.company_id.name }} Invoice (Ref {{ object.name or 'n/a' }})", + 'report_template_ids': [(4, cls.env.ref('account.account_invoices').id)], + 'lang': "{{ object.partner_id.lang }}", + }) + # Fixed Taxes cls.recupel = cls.env['account.tax'].create({ 'name': "RECUPEL", @@ -46,17 +55,6 @@ class TestUBLCommon(AccountEdiTestCommon): 'sequence': 2, }) - @classmethod - def setup_company_data(cls, company_name, chart_template=None, **kwargs): - # OVERRIDE to force the company with EUR currency. - eur = cls.env.ref('base.EUR') - if not eur.active: - eur.active = True - - res = super().setup_company_data(company_name, chart_template=chart_template, **kwargs) - res['company'].currency_id = eur - return res - def assert_same_invoice(self, invoice1, invoice2, **invoice_kwargs): self.assertEqual(len(invoice1.invoice_line_ids), len(invoice2.invoice_line_ids)) self.assertRecordValues(invoice2, [{ @@ -87,76 +85,58 @@ class TestUBLCommon(AccountEdiTestCommon): @freeze_time('2017-01-01') def _assert_imported_invoice_from_etree(self, invoice, attachment): """ - Create an account.move directly from an attachment file, asserts the invoice obtained is the same as the expected + Create an account.move directly from an xml file, asserts the invoice obtained is the same as the expected invoice. """ # /!\ use the same journal as the invoice's one to import the attachment ! - new_invoice = self.edi_format\ - .with_context(default_move_type=invoice.move_type)\ - ._create_document_from_attachment(attachment) + invoice.journal_id.create_document_from_attachment(attachment.ids) + new_invoice = self.env['account.move'].search([], order='id desc', limit=1) self.assertTrue(new_invoice) self.assert_same_invoice(invoice, new_invoice) - def _assert_imported_invoice_from_file(self, subfolder, filename, amount_total, amount_tax, list_line_subtotals, - list_line_price_unit=None, list_line_discount=None, list_line_taxes=None, - move_type='in_invoice', currency_id=None): + def _update_invoice_from_file(self, module_name, subfolder, filename, invoice): + """ Create an attachment from a file and post it on the invoice """ - Create an empty account.move, update the file to fill its fields, asserts the currency, total and tax amounts - are as expected. - """ - if not currency_id: - currency_id = self.env.ref('base.EUR').id - - # Create empty account.move, then update a file - if move_type == 'in_invoice': - invoice = self._create_empty_vendor_bill() - elif move_type == 'out_invoice': - invoice = self.env['account.move'].create({ - 'move_type': move_type, - 'journal_id': self.company_data['default_journal_sale'].id, + file_path = opj(module_name, subfolder, filename) + with misc.file_open(file_path, 'rb', filter_ext=('.xml',)) as file: + attachment = self.env['ir.attachment'].create({ + 'name': filename, + 'datas': base64.encodebytes(file.read()), + 'res_id': invoice.id, + 'res_model': 'account.move', }) + invoice.message_post(message_type='comment', attachment_ids=attachment.ids) + + def _assert_imported_invoice_from_file(self, subfolder, filename, invoice_vals, move_type='in_invoice'): + """ Create an empty account.move, update the xml file, and then check the invoice values. """ + if move_type in self.env['account.move'].get_purchase_types(): + journal = self.company_data['default_journal_purchase'] else: - invoice = self.env['account.move'].create({ - 'move_type': move_type, - 'journal_id': self.company_data['default_journal_purchase'].id, - }) - invoice_count = len(self.env['account.move'].search([])) - - # Import the file to fill the empty invoice - self.update_invoice_from_file('l10n_account_edi_ubl_cii_tests', subfolder, filename, invoice) - - # Checks - self.assertEqual(len(self.env['account.move'].search([])), invoice_count) - self.assertRecordValues(invoice, [{ - 'amount_total': amount_total, - 'amount_tax': amount_tax, - 'currency_id': currency_id, - }]) - self.assertEqual( - Counter(invoice.invoice_line_ids.mapped('price_subtotal')), - Counter(list_line_subtotals), + journal = self.company_data['default_journal_sale'] + invoice = self.env['account.move'].create({'move_type': move_type, 'journal_id': journal.id}) + self._update_invoice_from_file( + module_name='l10n_account_edi_ubl_cii_tests', + subfolder=subfolder, + filename=filename, + invoice=invoice, ) - if list_line_price_unit: - self.assertEqual(invoice.invoice_line_ids.mapped('price_unit'), list_line_price_unit) - if list_line_discount: - # See test_import_tax_included: sometimes, it's impossible to retrieve the exact discount at import because - # of rounding during export. The obtained discount might be 10.001 while the expected is 10. - dp = self.env.ref('product.decimal_discount').precision_get("Discount") - self.assertEqual([round(d, dp) for d in invoice.invoice_line_ids.mapped('discount')], list_line_discount) - if list_line_taxes: - for line, taxes in zip(invoice.invoice_line_ids, list_line_taxes): - self.assertEqual(line.tax_ids, taxes) + invoice_vals = invoice_vals.copy() + invoice_lines = invoice_vals.pop('invoice_lines', False) + self.assertRecordValues(invoice, [invoice_vals]) + if invoice_lines: + self.assertRecordValues(invoice.invoice_line_ids, invoice_lines) # ------------------------------------------------------------------------- # EXPORT HELPERS # ------------------------------------------------------------------------- @freeze_time('2017-01-01') - def _generate_move(self, seller, buyer, **invoice_kwargs): + def _generate_move(self, seller, buyer, send=True, **invoice_kwargs): """ Create and post an account.move. """ + # Setup the seller. self.env.company.write({ 'partner_id': seller.id, @@ -175,7 +155,7 @@ class TestUBLCommon(AccountEdiTestCommon): 'invoice_payment_term_id': self.pay_terms_b.id, 'invoice_date': '2017-01-01', 'date': '2017-01-01', - 'currency_id': self.currency_data['currency'].id, + 'currency_id': self.other_currency.id, 'narration': 'test narration', 'ref': 'ref_move', **invoice_kwargs, @@ -187,23 +167,24 @@ class TestUBLCommon(AccountEdiTestCommon): for i, invoice_line_kwargs in enumerate(invoice_kwargs.get('invoice_line_ids', [])) ], }) - # this is needed for formats not enabled by default on the journal - account_move.journal_id.edi_format_ids += self.edi_format + account_move.action_post() + if send: + # will set the right UBL format by default thanks to the partner's compute + account_move._generate_and_send(sending_methods=['manual']) return account_move - def _assert_invoice_attachment(self, invoice, 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. """ - attachment = invoice._get_edi_attachment(self.edi_format) self.assertTrue(attachment) - xml_filename = attachment.name + 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_full_path = misc.file_path(f'{self.test_module}/tests/test_files/{expected_file_path}') + expected_etree = etree.parse(expected_file_full_path).getroot() modified_etree = self.with_applied_xpath( expected_etree, @@ -217,32 +198,45 @@ class TestUBLCommon(AccountEdiTestCommon): return attachment - def _import_invoice_attachment(self, invoice, edi_code, journal): - """ Extract the attachment from the invoice and import it on the given journal. + def _test_import_partner(self, attachment, seller, buyer): """ - # Get the attachment from the invoice - edi_attachment = invoice.edi_document_ids.filtered( - lambda doc: doc.edi_format_id.code == edi_code).attachment_id - edi_etree = self.get_xml_tree_from_string(edi_attachment.raw) + Given a buyer and seller in an EDI attachment. + * Uploading the attachment as an invoice should create an invoice with the partner = buyer. + * Uploading the attachment as a vendor bill should create a bill with the partner = seller. + """ + # Import attachment as an invoice + new_invoice = self.company_data['default_journal_sale']._create_document_from_attachment(attachment.ids) + self.assertEqual(buyer, new_invoice.partner_id) - # import the attachment and return the resulting invoice - return self.edi_format._create_invoice_from_xml_tree( - filename='test_filename', - tree=edi_etree, - journal=journal, - ) + # Import attachment as a vendor bill + new_invoice = self.company_data['default_journal_purchase']._create_document_from_attachment(attachment.ids) + self.assertEqual(seller, new_invoice.partner_id) - def _test_encoding_in_attachment(self, edi_code, filename): + def _test_import_in_journal(self, attachment): + """ + If the context contains the info about the current default journal, we should use it + instead of infering the journal from the move type. + """ + journal2 = self.company_data['default_journal_sale'].copy() + journal2.default_account_id = self.company_data['default_account_revenue'].id + journal3 = journal2.copy() + journal3.default_account_id = self.company_data['default_account_revenue'].id # Not copied + + # Use the journal if it's set + new_invoice = journal2._create_document_from_attachment(attachment.id) + self.assertEqual(new_invoice.journal_id, journal2) + + # If no journal, fallback on the context + new_invoice2 = self.env['account.journal'].with_context(default_journal_id=journal3.id)._create_document_from_attachment(attachment.id) + self.assertEqual(new_invoice2.journal_id, journal3) + + # If no journal and no journal in the context, fallback on the move type + new_invoice3 = self.env['account.journal'].with_context(default_move_type='out_invoice')._create_document_from_attachment(attachment.id) + self.assertEqual(new_invoice3.journal_id, self.company_data['default_journal_sale']) + + def _test_encoding_in_attachment(self, attachment, filename): """ Generate an invoice, assert that the tag '' is present in the attachment """ - invoice = self._generate_move( - seller=self.partner_1, - buyer=self.partner_2, - move_type='out_invoice', - invoice_line_ids=[{'product_id': self.product_a.id}], - ) - edi_attachment = invoice.edi_document_ids.filtered( - lambda doc: doc.edi_format_id.code == edi_code).attachment_id - self.assertEqual(edi_attachment.name, filename) - self.assertIn(b"", edi_attachment.raw) + self.assertTrue(filename in attachment.name) + self.assertIn(b"", attachment.raw) diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_factur-x_doc/facturx_credit_note_type380.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_factur-x_doc/facturx_credit_note_type380.xml index b7474a4..2f54376 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_factur-x_doc/facturx_credit_note_type380.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_factur-x_doc/facturx_credit_note_type380.xml @@ -95,7 +95,7 @@ +33 4 72 07 08 56 - tony.dubois@aubonmoulin.fr + tony.dubois@aubonmoulin.fr @@ -119,7 +119,7 @@ +33 4 72 07 08 67 - alexandre.payet@majolieboutique.net + alexandre.payet@majolieboutique.net diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_factur-x_doc/facturx_credit_note_type381.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_factur-x_doc/facturx_credit_note_type381.xml index d4dfeff..e275e60 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_factur-x_doc/facturx_credit_note_type381.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_factur-x_doc/facturx_credit_note_type381.xml @@ -95,7 +95,7 @@ +33 4 72 07 08 56 - tony.dubois@aubonmoulin.fr + tony.dubois@aubonmoulin.fr @@ -119,7 +119,7 @@ +33 4 72 07 08 67 - alexandre.payet@majolieboutique.net + alexandre.payet@majolieboutique.net diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice.xml index 9dead5e..86cc0bf 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice.xml @@ -10,11 +10,20 @@ USD ref_partner_2 - ref_move + ___ignore___ + + ___ignore___ + + ___ignore___ + + 83914571673 + + ref_partner_1 + partner_1 @@ -46,6 +55,9 @@ 53930548027 + + ref_partner_2 + partner_2 @@ -72,6 +84,23 @@ + + + + Parliament Dr + Canberra + 2600 + + AU + + + + + + partner_2 + + + 30 INV/2017/00001 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice_attacheddocument_b64.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice_attacheddocument_b64.xml new file mode 100644 index 0000000..8486c84 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice_attacheddocument_b64.xml @@ -0,0 +1,179 @@ + + + 2.1 + urn:cen.eu:en16931:2017#conformant#urn:fdc:peppol.eu:2017:poacc:billing:international:aunz:3.0 + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + AttachedDocument + 2017-01-01 + 12:00:00 + string + INV/2017/00001 + + 83914571673 + + partner_1 + + + Spring St. + Melbourne + 3002 + + AU + + + + 83914571673 + + GST + + + + partner_1 + 83914571673 + + + partner_1 + +31 180 6 225789 + info@outlook.au + + + + 53930548027 + + partner_2 + + + Parliament Dr + Canberra + 2600 + + AU + + + + 53930548027 + + GST + + + + partner_2 + 53930548027 + + + partner_2 + + + + +PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4KPEludm9pY2UgeG1sbnM9InVy +bjpvYXNpczpuYW1lczpzcGVjaWZpY2F0aW9uOnVibDpzY2hlbWE6eHNkOkludm9pY2UtMiIgeG1s +bnM6Y2FjPSJ1cm46b2FzaXM6bmFtZXM6c3BlY2lmaWNhdGlvbjp1Ymw6c2NoZW1hOnhzZDpDb21t +b25BZ2dyZWdhdGVDb21wb25lbnRzLTIiIHhtbG5zOmNiYz0idXJuOm9hc2lzOm5hbWVzOnNwZWNp +ZmljYXRpb246dWJsOnNjaGVtYTp4c2Q6Q29tbW9uQmFzaWNDb21wb25lbnRzLTIiPgogIDxjYmM6 +Q3VzdG9taXphdGlvbklEPnVybjpjZW4uZXU6ZW4xNjkzMToyMDE3I2NvbmZvcm1hbnQjdXJuOmZk +YzpwZXBwb2wuZXU6MjAxNzpwb2FjYzpiaWxsaW5nOmludGVybmF0aW9uYWw6YXVuejozLjA8L2Ni +YzpDdXN0b21pemF0aW9uSUQ+CiAgPGNiYzpQcm9maWxlSUQ+dXJuOmZkYzpwZXBwb2wuZXU6MjAx +Nzpwb2FjYzpiaWxsaW5nOjAxOjEuMDwvY2JjOlByb2ZpbGVJRD4KICA8Y2JjOklEPklOVi8yMDE3 +LzAwMDAxPC9jYmM6SUQ+CiAgPGNiYzpJc3N1ZURhdGU+MjAxNy0wMS0wMTwvY2JjOklzc3VlRGF0 +ZT4KPGNiYzpEdWVEYXRlPjIwMTctMDItMjg8L2NiYzpEdWVEYXRlPgo8Y2JjOkludm9pY2VUeXBl +Q29kZT4zODA8L2NiYzpJbnZvaWNlVHlwZUNvZGU+CjxjYmM6Tm90ZT50ZXN0IG5hcnJhdGlvbjwv +Y2JjOk5vdGU+CjxjYmM6RG9jdW1lbnRDdXJyZW5jeUNvZGU+VVNEPC9jYmM6RG9jdW1lbnRDdXJy +ZW5jeUNvZGU+CjxjYmM6QnV5ZXJSZWZlcmVuY2U+cmVmX3BhcnRuZXJfMjwvY2JjOkJ1eWVyUmVm +ZXJlbmNlPgo8Y2FjOk9yZGVyUmVmZXJlbmNlPgo8Y2JjOklEPl9fX2lnbm9yZV9fXzwvY2JjOklE +Pgo8L2NhYzpPcmRlclJlZmVyZW5jZT4KPGNhYzpBZGRpdGlvbmFsRG9jdW1lbnRSZWZlcmVuY2U+ +CjxjYmM6SUQ+X19faWdub3JlX19fPC9jYmM6SUQ+CjxjYmM6QXR0YWNobWVudD4KPGNiYzpFbWJl +ZGRlZERvY3VtZW50QmluYXJ5T2JqZWN0Pl9fX2lnbm9yZV9fXzwvY2JjOkVtYmVkZGVkRG9jdW1l +bnRCaW5hcnlPYmplY3Q+CjwvY2JjOkF0dGFjaG1lbnQ+CjwvY2FjOkFkZGl0aW9uYWxEb2N1bWVu +dFJlZmVyZW5jZT4KPGNhYzpBY2NvdW50aW5nU3VwcGxpZXJQYXJ0eT4KPGNhYzpQYXJ0eT4KPGNi +YzpFbmRwb2ludElEIHNjaGVtZUlEPSIwMTUxIj44MzkxNDU3MTY3MzwvY2JjOkVuZHBvaW50SUQ+ +CjxjYWM6UGFydHlOYW1lPgo8Y2JjOk5hbWU+cGFydG5lcl8xPC9jYmM6TmFtZT4KPC9jYWM6UGFy +dHlOYW1lPgo8Y2FjOlBvc3RhbEFkZHJlc3M+CjxjYmM6U3RyZWV0TmFtZT5TcHJpbmcgU3QuPC9j +YmM6U3RyZWV0TmFtZT4KPGNiYzpDaXR5TmFtZT5NZWxib3VybmU8L2NiYzpDaXR5TmFtZT4KPGNi +YzpQb3N0YWxab25lPjMwMDI8L2NiYzpQb3N0YWxab25lPgo8Y2FjOkNvdW50cnk+CjxjYmM6SWRl +bnRpZmljYXRpb25Db2RlPkFVPC9jYmM6SWRlbnRpZmljYXRpb25Db2RlPgo8L2NhYzpDb3VudHJ5 +Pgo8L2NhYzpQb3N0YWxBZGRyZXNzPgo8Y2FjOlBhcnR5VGF4U2NoZW1lPgo8Y2JjOkNvbXBhbnlJ +RD44MzkxNDU3MTY3MzwvY2JjOkNvbXBhbnlJRD4KPGNhYzpUYXhTY2hlbWU+CjxjYmM6SUQ+R1NU +PC9jYmM6SUQ+CjwvY2FjOlRheFNjaGVtZT4KPC9jYWM6UGFydHlUYXhTY2hlbWU+CjxjYWM6UGFy +dHlMZWdhbEVudGl0eT4KPGNiYzpSZWdpc3RyYXRpb25OYW1lPnBhcnRuZXJfMTwvY2JjOlJlZ2lz +dHJhdGlvbk5hbWU+CjxjYmM6Q29tcGFueUlEIHNjaGVtZUlEPSIwMTUxIj44MzkxNDU3MTY3Mzwv +Y2JjOkNvbXBhbnlJRD4KPC9jYWM6UGFydHlMZWdhbEVudGl0eT4KPGNhYzpDb250YWN0Pgo8Y2Jj +Ok5hbWU+cGFydG5lcl8xPC9jYmM6TmFtZT4KPGNiYzpUZWxlcGhvbmU+KzMxIDE4MCA2IDIyNTc4 +OTwvY2JjOlRlbGVwaG9uZT4KPGNiYzpFbGVjdHJvbmljTWFpbD5pbmZvQG91dGxvb2suYXU8L2Ni +YzpFbGVjdHJvbmljTWFpbD4KPC9jYWM6Q29udGFjdD4KPC9jYWM6UGFydHk+CjwvY2FjOkFjY291 +bnRpbmdTdXBwbGllclBhcnR5Pgo8Y2FjOkFjY291bnRpbmdDdXN0b21lclBhcnR5Pgo8Y2FjOlBh +cnR5Pgo8Y2JjOkVuZHBvaW50SUQgc2NoZW1lSUQ9IjAxNTEiPjUzOTMwNTQ4MDI3PC9jYmM6RW5k +cG9pbnRJRD4KPGNhYzpQYXJ0eU5hbWU+CjxjYmM6TmFtZT5wYXJ0bmVyXzI8L2NiYzpOYW1lPgo8 +L2NhYzpQYXJ0eU5hbWU+CjxjYWM6UG9zdGFsQWRkcmVzcz4KPGNiYzpTdHJlZXROYW1lPlBhcmxp +YW1lbnQgRHI8L2NiYzpTdHJlZXROYW1lPgo8Y2JjOkNpdHlOYW1lPkNhbmJlcnJhPC9jYmM6Q2l0 +eU5hbWU+CjxjYmM6UG9zdGFsWm9uZT4yNjAwPC9jYmM6UG9zdGFsWm9uZT4KPGNhYzpDb3VudHJ5 +Pgo8Y2JjOklkZW50aWZpY2F0aW9uQ29kZT5BVTwvY2JjOklkZW50aWZpY2F0aW9uQ29kZT4KPC9j +YWM6Q291bnRyeT4KPC9jYWM6UG9zdGFsQWRkcmVzcz4KPGNhYzpQYXJ0eVRheFNjaGVtZT4KPGNi +YzpDb21wYW55SUQ+NTM5MzA1NDgwMjc8L2NiYzpDb21wYW55SUQ+CjxjYWM6VGF4U2NoZW1lPgo8 +Y2JjOklEPkdTVDwvY2JjOklEPgo8L2NhYzpUYXhTY2hlbWU+CjwvY2FjOlBhcnR5VGF4U2NoZW1l +Pgo8Y2FjOlBhcnR5TGVnYWxFbnRpdHk+CjxjYmM6UmVnaXN0cmF0aW9uTmFtZT5wYXJ0bmVyXzI8 +L2NiYzpSZWdpc3RyYXRpb25OYW1lPgo8Y2JjOkNvbXBhbnlJRCBzY2hlbWVJRD0iMDE1MSI+NTM5 +MzA1NDgwMjc8L2NiYzpDb21wYW55SUQ+CjwvY2FjOlBhcnR5TGVnYWxFbnRpdHk+CjxjYWM6Q29u +dGFjdD4KPGNiYzpOYW1lPnBhcnRuZXJfMjwvY2JjOk5hbWU+CjwvY2FjOkNvbnRhY3Q+CjwvY2Fj +OlBhcnR5Pgo8L2NhYzpBY2NvdW50aW5nQ3VzdG9tZXJQYXJ0eT4KPGNhYzpEZWxpdmVyeT4KPGNh +YzpEZWxpdmVyeUxvY2F0aW9uPgo8Y2FjOkFkZHJlc3M+CjxjYmM6U3RyZWV0TmFtZT5QYXJsaWFt +ZW50IERyPC9jYmM6U3RyZWV0TmFtZT4KPGNiYzpDaXR5TmFtZT5DYW5iZXJyYTwvY2JjOkNpdHlO +YW1lPgo8Y2JjOlBvc3RhbFpvbmU+MjYwMDwvY2JjOlBvc3RhbFpvbmU+CjxjYWM6Q291bnRyeT4K +PGNiYzpJZGVudGlmaWNhdGlvbkNvZGU+QVU8L2NiYzpJZGVudGlmaWNhdGlvbkNvZGU+CjwvY2Fj +OkNvdW50cnk+CjwvY2FjOkFkZHJlc3M+CjwvY2FjOkRlbGl2ZXJ5TG9jYXRpb24+CjwvY2FjOkRl +bGl2ZXJ5Pgo8Y2FjOlBheW1lbnRNZWFucz4KPGNiYzpQYXltZW50TWVhbnNDb2RlIG5hbWU9ImNy +ZWRpdCB0cmFuc2ZlciI+MzA8L2NiYzpQYXltZW50TWVhbnNDb2RlPgo8Y2JjOlBheW1lbnRJRD5J +TlYvMjAxNy8wMDAwMTwvY2JjOlBheW1lbnRJRD4KPGNhYzpQYXllZUZpbmFuY2lhbEFjY291bnQ+ +CjxjYmM6SUQ+MDAwMDk5OTk4QjU3PC9jYmM6SUQ+CjwvY2FjOlBheWVlRmluYW5jaWFsQWNjb3Vu +dD4KPC9jYWM6UGF5bWVudE1lYW5zPgo8Y2FjOlBheW1lbnRUZXJtcz4KPGNiYzpOb3RlPlBheW1l +bnQgdGVybXM6IDMwJSBBZHZhbmNlIEVuZCBvZiBGb2xsb3dpbmcgTW9udGg8L2NiYzpOb3RlPgo8 +L2NhYzpQYXltZW50VGVybXM+CjxjYWM6VGF4VG90YWw+CjxjYmM6VGF4QW1vdW50IGN1cnJlbmN5 +SUQ9IlVTRCI+MjY4LjIwPC9jYmM6VGF4QW1vdW50Pgo8Y2FjOlRheFN1YnRvdGFsPgo8Y2JjOlRh +eGFibGVBbW91bnQgY3VycmVuY3lJRD0iVVNEIj4yNjgyLjAwPC9jYmM6VGF4YWJsZUFtb3VudD4K +PGNiYzpUYXhBbW91bnQgY3VycmVuY3lJRD0iVVNEIj4yNjguMjA8L2NiYzpUYXhBbW91bnQ+Cjxj +YWM6VGF4Q2F0ZWdvcnk+CjxjYmM6SUQ+UzwvY2JjOklEPgo8Y2JjOlBlcmNlbnQ+MTAuMDwvY2Jj +OlBlcmNlbnQ+CjxjYWM6VGF4U2NoZW1lPgo8Y2JjOklEPkdTVDwvY2JjOklEPgo8L2NhYzpUYXhT +Y2hlbWU+CjwvY2FjOlRheENhdGVnb3J5Pgo8L2NhYzpUYXhTdWJ0b3RhbD4KPC9jYWM6VGF4VG90 +YWw+CjxjYWM6TGVnYWxNb25ldGFyeVRvdGFsPgo8Y2JjOkxpbmVFeHRlbnNpb25BbW91bnQgY3Vy +cmVuY3lJRD0iVVNEIj4yNjgyLjAwPC9jYmM6TGluZUV4dGVuc2lvbkFtb3VudD4KPGNiYzpUYXhF +eGNsdXNpdmVBbW91bnQgY3VycmVuY3lJRD0iVVNEIj4yNjgyLjAwPC9jYmM6VGF4RXhjbHVzaXZl +QW1vdW50Pgo8Y2JjOlRheEluY2x1c2l2ZUFtb3VudCBjdXJyZW5jeUlEPSJVU0QiPjI5NTAuMjA8 +L2NiYzpUYXhJbmNsdXNpdmVBbW91bnQ+CjxjYmM6UHJlcGFpZEFtb3VudCBjdXJyZW5jeUlEPSJV +U0QiPjAuMDA8L2NiYzpQcmVwYWlkQW1vdW50Pgo8Y2JjOlBheWFibGVBbW91bnQgY3VycmVuY3lJ +RD0iVVNEIj4yOTUwLjIwPC9jYmM6UGF5YWJsZUFtb3VudD4KPC9jYWM6TGVnYWxNb25ldGFyeVRv +dGFsPgo8Y2FjOkludm9pY2VMaW5lPgo8Y2JjOklEPjU1NzwvY2JjOklEPgo8Y2JjOkludm9pY2Vk +UXVhbnRpdHkgdW5pdENvZGU9IkRaTiI+Mi4wPC9jYmM6SW52b2ljZWRRdWFudGl0eT4KPGNiYzpM +aW5lRXh0ZW5zaW9uQW1vdW50IGN1cnJlbmN5SUQ9IlVTRCI+MTc4Mi4wMDwvY2JjOkxpbmVFeHRl +bnNpb25BbW91bnQ+CjxjYWM6QWxsb3dhbmNlQ2hhcmdlPgo8Y2JjOkNoYXJnZUluZGljYXRvcj5m +YWxzZTwvY2JjOkNoYXJnZUluZGljYXRvcj4KPGNiYzpBbGxvd2FuY2VDaGFyZ2VSZWFzb25Db2Rl +Pjk1PC9jYmM6QWxsb3dhbmNlQ2hhcmdlUmVhc29uQ29kZT4KPGNiYzpBbW91bnQgY3VycmVuY3lJ +RD0iVVNEIj4xOTguMDA8L2NiYzpBbW91bnQ+CjwvY2FjOkFsbG93YW5jZUNoYXJnZT4KPGNhYzpJ +dGVtPgo8Y2JjOkRlc2NyaXB0aW9uPnByb2R1Y3RfYTwvY2JjOkRlc2NyaXB0aW9uPgo8Y2JjOk5h +bWU+cHJvZHVjdF9hPC9jYmM6TmFtZT4KPGNhYzpDbGFzc2lmaWVkVGF4Q2F0ZWdvcnk+CjxjYmM6 +SUQ+UzwvY2JjOklEPgo8Y2JjOlBlcmNlbnQ+MTAuMDwvY2JjOlBlcmNlbnQ+CjxjYWM6VGF4U2No +ZW1lPgo8Y2JjOklEPkdTVDwvY2JjOklEPgo8L2NhYzpUYXhTY2hlbWU+CjwvY2FjOkNsYXNzaWZp +ZWRUYXhDYXRlZ29yeT4KPC9jYWM6SXRlbT4KPGNhYzpQcmljZT4KPGNiYzpQcmljZUFtb3VudCBj +dXJyZW5jeUlEPSJVU0QiPjk5MC4wPC9jYmM6UHJpY2VBbW91bnQ+CjwvY2FjOlByaWNlPgo8L2Nh +YzpJbnZvaWNlTGluZT4KPGNhYzpJbnZvaWNlTGluZT4KPGNiYzpJRD41NTg8L2NiYzpJRD4KPGNi +YzpJbnZvaWNlZFF1YW50aXR5IHVuaXRDb2RlPSJDNjIiPjEwLjA8L2NiYzpJbnZvaWNlZFF1YW50 +aXR5Pgo8Y2JjOkxpbmVFeHRlbnNpb25BbW91bnQgY3VycmVuY3lJRD0iVVNEIj4xMDAwLjAwPC9j +YmM6TGluZUV4dGVuc2lvbkFtb3VudD4KPGNhYzpJdGVtPgo8Y2JjOkRlc2NyaXB0aW9uPnByb2R1 +Y3RfYjwvY2JjOkRlc2NyaXB0aW9uPgo8Y2JjOk5hbWU+cHJvZHVjdF9iPC9jYmM6TmFtZT4KPGNh +YzpDbGFzc2lmaWVkVGF4Q2F0ZWdvcnk+CjxjYmM6SUQ+UzwvY2JjOklEPgo8Y2JjOlBlcmNlbnQ+ +MTAuMDwvY2JjOlBlcmNlbnQ+CjxjYWM6VGF4U2NoZW1lPgo8Y2JjOklEPkdTVDwvY2JjOklEPgo8 +L2NhYzpUYXhTY2hlbWU+CjwvY2FjOkNsYXNzaWZpZWRUYXhDYXRlZ29yeT4KPC9jYWM6SXRlbT4K +PGNhYzpQcmljZT4KPGNiYzpQcmljZUFtb3VudCBjdXJyZW5jeUlEPSJVU0QiPjEwMC4wPC9jYmM6 +UHJpY2VBbW91bnQ+CjwvY2FjOlByaWNlPgo8L2NhYzpJbnZvaWNlTGluZT4KPGNhYzpJbnZvaWNl +TGluZT4KPGNiYzpJRD41NTk8L2NiYzpJRD4KPGNiYzpJbnZvaWNlZFF1YW50aXR5IHVuaXRDb2Rl +PSJDNjIiPi0xLjA8L2NiYzpJbnZvaWNlZFF1YW50aXR5Pgo8Y2JjOkxpbmVFeHRlbnNpb25BbW91 +bnQgY3VycmVuY3lJRD0iVVNEIj4tMTAwLjAwPC9jYmM6TGluZUV4dGVuc2lvbkFtb3VudD4KPGNh +YzpJdGVtPgo8Y2JjOkRlc2NyaXB0aW9uPnByb2R1Y3RfYjwvY2JjOkRlc2NyaXB0aW9uPgo8Y2Jj +Ok5hbWU+cHJvZHVjdF9iPC9jYmM6TmFtZT4KPGNhYzpDbGFzc2lmaWVkVGF4Q2F0ZWdvcnk+Cjxj +YmM6SUQ+UzwvY2JjOklEPgo8Y2JjOlBlcmNlbnQ+MTAuMDwvY2JjOlBlcmNlbnQ+CjxjYWM6VGF4 +U2NoZW1lPgo8Y2JjOklEPkdTVDwvY2JjOklEPgo8L2NhYzpUYXhTY2hlbWU+CjwvY2FjOkNsYXNz +aWZpZWRUYXhDYXRlZ29yeT4KPC9jYWM6SXRlbT4KPGNhYzpQcmljZT4KPGNiYzpQcmljZUFtb3Vu +dCBjdXJyZW5jeUlEPSJVU0QiPjEwMC4wPC9jYmM6UHJpY2VBbW91bnQ+CjwvY2FjOlByaWNlPgo8 +L2NhYzpJbnZvaWNlTGluZT4KPC9JbnZvaWNlPg== + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice_attacheddocument_description.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice_attacheddocument_description.xml new file mode 100644 index 0000000..81cc1f8 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_invoice_attacheddocument_description.xml @@ -0,0 +1,259 @@ + + + 2.1 + urn:cen.eu:en16931:2017#conformant#urn:fdc:peppol.eu:2017:poacc:billing:international:aunz:3.0 + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + AttachedDocument + 2017-01-01 + 12:00:00 + string + INV/2017/00001 + + 83914571673 + + partner_1 + + + Spring St. + Melbourne + 3002 + + AU + + + + 83914571673 + + GST + + + + partner_1 + 83914571673 + + + partner_1 + +31 180 6 225789 + info@outlook.au + + + + 53930548027 + + partner_2 + + + Parliament Dr + Canberra + 2600 + + AU + + + + 53930548027 + + GST + + + + partner_2 + 53930548027 + + + partner_2 + + + + + text/xml + UTF-8 + + + urn:cen.eu:en16931:2017#conformant#urn:fdc:peppol.eu:2017:poacc:billing:international:aunz:3.0 + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + INV/2017/00001 + 2017-01-01 + 2017-02-28 + 380 + test narration + USD + ref_partner_2 + + ___ignore___ + + + ___ignore___ + + ___ignore___ + + + + + 83914571673 + + partner_1 + + + Spring St. + Melbourne + 3002 + + AU + + + + 83914571673 + + GST + + + + partner_1 + 83914571673 + + + partner_1 + +31 180 6 225789 + info@outlook.au + + + + + + 53930548027 + + partner_2 + + + Parliament Dr + Canberra + 2600 + + AU + + + + 53930548027 + + GST + + + + partner_2 + 53930548027 + + + partner_2 + + + + + + + Parliament Dr + Canberra + 2600 + + AU + + + + + + 30 + INV/2017/00001 + + 000099998B57 + + + + Payment terms: 30% Advance End of Following Month + + + 268.20 + + 2682.00 + 268.20 + + S + 10.0 + + GST + + + + + + 2682.00 + 2682.00 + 2950.20 + 0.00 + 2950.20 + + + 557 + 2.0 + 1782.00 + + false + 95 + 198.00 + + + product_a + product_a + + S + 10.0 + + GST + + + + + 990.0 + + + + 558 + 10.0 + 1000.00 + + product_b + product_b + + S + 10.0 + + GST + + + + + 100.0 + + + + 559 + -1.0 + -100.00 + + product_b + product_b + + S + 10.0 + + GST + + + + + 100.0 + + +]]> + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_refund.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_refund.xml index 7bc8781..43259d7 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_refund.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/a_nz_out_refund.xml @@ -9,11 +9,20 @@ USD ref_partner_2 - ref_move + ___ignore___ + + ___ignore___ + + ___ignore___ + + 83914571673 + + ref_partner_1 + partner_1 @@ -45,6 +54,9 @@ 53930548027 + + ref_partner_2 + partner_2 @@ -71,6 +83,23 @@ + + + + Parliament Dr + Canberra + 2600 + + AU + + + + + + partner_2 + + + 57 RINV/2017/00001 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case1.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case1.xml index 01f308a..57b7cf4 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case1.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case1.xml @@ -15,9 +15,18 @@ ___ignore___ + + ___ignore___ + + ___ignore___ + + - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -37,7 +46,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -46,7 +55,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -66,13 +78,30 @@ partner_2 - BE0477472701 + 0477472701 partner_2 + + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + + + partner_2 + + + 30 ___ignore___ diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case2.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case2.xml index 8fe29a5..4cc3adc 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case2.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case2.xml @@ -15,9 +15,18 @@ ___ignore___ + + ___ignore___ + + ___ignore___ + + - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -37,7 +46,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -46,7 +55,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -66,13 +78,30 @@ partner_2 - BE0477472701 + 0477472701 partner_2 + + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + + + partner_2 + + + 30 ___ignore___ diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case3.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case3.xml index aee1bc5..a20d1f2 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case3.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case3.xml @@ -15,9 +15,18 @@ ___ignore___ + + ___ignore___ + + ___ignore___ + + - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -37,7 +46,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -46,7 +55,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -66,13 +78,30 @@ partner_2 - BE0477472701 + 0477472701 partner_2 + + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + + + partner_2 + + + 30 ___ignore___ diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case4.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case4.xml index 968853c..01ef08a 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case4.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_ecotaxes_case4.xml @@ -15,9 +15,18 @@ ___ignore___ + + ___ignore___ + + ___ignore___ + + - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -37,7 +46,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -46,7 +55,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -66,13 +78,30 @@ partner_2 - BE0477472701 + 0477472701 partner_2 + + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + + + partner_2 + + + 30 ___ignore___ diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice.xml index 8d1a6c9..4e56b92 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice.xml @@ -8,13 +8,23 @@ 380 test narration USD + EUR ref_partner_2 - ref_move + ___ignore___ + + ___ignore___ + + ___ignore___ + + - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -34,7 +44,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -43,7 +53,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -63,13 +76,31 @@ partner_2 - BE0477472701 + 0477472701 partner_2 + + 2017-01-15 + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + + + partner_2 + + + 30 +++000/0000/26268+++ @@ -105,6 +136,9 @@ + + 241.11 + 2682.00 2682.00 @@ -119,7 +153,10 @@ false 95 + Discount + 10.0 198.00 + 1980.00 product_a diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_negative_unit_price.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_negative_unit_price.xml deleted file mode 100644 index 92df5e9..0000000 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_negative_unit_price.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 - - urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - ___ignore___ - 2017-01-01 - 2017-02-28 - 380 - test narration - USD - ref_partner_2 - - ___ignore___ - - - - BE0202239951 - - partner_1 - - - Chaussée de Namur 40 - Ramillies - 1367 - - BE - - - - BE0202239951 - - VAT - - - - partner_1 - BE0202239951 - - - partner_1 - - - - - - BE0477472701 - - partner_2 - - - Rue des Bourlottes 9 - Ramillies - 1367 - - BE - - - - BE0477472701 - - VAT - - - - partner_2 - BE0477472701 - - - partner_2 - - - - - 30 - ___ignore___ - - BE15001559627230 - - - - Payment terms: 30% Advance End of Following Month - - - 15.75 - - 75.00 - 15.75 - - S - 21.0 - - VAT - - - - - - 75.00 - 75.00 - 90.75 - 0.00 - 90.75 - - - ___ignore___ - 1.0 - 100.00 - - product_a - product_a - - S - 21.0 - - VAT - - - - - 100.0 - - - - ___ignore___ - -1.0 - -25.00 - - product_a - product_a - - S - 21.0 - - VAT - - - - - 25.0 - - - diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_no_prices.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_no_prices.xml index b1086f5..a17adcd 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_no_prices.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_no_prices.xml @@ -14,7 +14,10 @@ - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -34,7 +37,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -43,7 +46,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -63,7 +69,7 @@ partner_2 - BE0477472701 + 0477472701 partner_2 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_public_admin.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_public_admin.xml deleted file mode 100644 index 2f97892..0000000 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_public_admin.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 - urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - INV/2017/01/0002 - 2017-01-01 - 2017-02-28 - 380 - test narration - USD - ref_partner_2 - - ref_move - - - - BE0202239951 - - partner_1 - - - Chaussée de Namur 40 - Ramillies - 1367 - - BE - - - - BE0202239951 - - VAT - - - - partner_1 - BE0202239951 - - - partner_1 - - - - - - - partner_2 - - - Rue des Bourlottes 9 - Ramillies - 1367 - - BE - - - - partner_2 - - - partner_2 - - - - - 30 - +++000/0000/05959+++ - - BE15001559627230 - - - - Payment terms: 30% Advance End of Following Month - - - 42.00 - - 200.00 - 42.00 - - S - 21.0 - - VAT - - - - - - 200.00 - 200.00 - 242.00 - 0.00 - 242.00 - - - 234 - 2.0 - 200.00 - - product_a - product_a - - S - 21.0 - - VAT - - - - - 100.0 - - - diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_export_with_changed_taxes.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_quantity_and_or_unit_price_zero.xml similarity index 63% rename from odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_export_with_changed_taxes.xml rename to odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_quantity_and_or_unit_price_zero.xml index e7b505f..0782781 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_export_with_changed_taxes.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_quantity_and_or_unit_price_zero.xml @@ -2,7 +2,7 @@ urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - ___ignore___ + INV/2017/01/0002 2017-01-01 2017-02-28 380 @@ -10,11 +10,20 @@ USD ref_partner_2 - ref_move + ___ignore___ + + ___ignore___ + + ___ignore___ + + - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -34,7 +43,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -43,7 +52,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -63,16 +75,28 @@ partner_2 - BE0477472701 + 0477472701 partner_2 + + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + 30 - ___ignore___ + +++000/0000/26268+++ BE15001559627230 @@ -81,10 +105,10 @@ Payment terms: 30% Advance End of Following Month - 108.02 + 630.00 - 400.00 - 84.03 + 3000.00 + 630 S 21.0 @@ -93,73 +117,43 @@ - - 200.00 - 23.99 - - S - 12.0 - - VAT - - - - 600.00 - 600.00 - 708.02 + 3000.00 + 3000.00 + 3630.00 0.00 - 708.02 + 3630.00 - 1 - 1.0 - 200.00 - - product_a - product_a - - S - 21.0 - - VAT - - - - - 200.0 - - - - 2 - 1.0 - 200.00 - - product_a - product_a - - S - 21.0 - - VAT - - - - - 200.0 - - - - 3 - 1.0 - 100.00 + 901 + 0 + 1000.00 product_b product_b S - 12.0 + 21.0 + + VAT + + + + + 0 + + + + 902 + 0 + 1000.00 + + product_b + product_b + + S + 21.0 VAT @@ -170,22 +164,22 @@ - 4 - 1.0 - 100.00 + 903 + 100 + 1000.00 product_b product_b S - 12.0 + 21.0 VAT - 100.0 + 0 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_rounding.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_rounding.xml deleted file mode 100644 index a818b72..0000000 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_rounding.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 - - urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - ___ignore___ - 2017-01-01 - 2017-02-28 - 380 - test narration - USD - ref_partner_2 - - ___ignore___ - - - - BE0202239951 - - partner_1 - - - Chaussée de Namur 40 - Ramillies - 1367 - - BE - - - - BE0202239951 - - VAT - - - - partner_1 - BE0202239951 - - - partner_1 - - - - - - BE0477472701 - - partner_2 - - - Rue des Bourlottes 9 - Ramillies - 1367 - - BE - - - - BE0477472701 - - VAT - - - - partner_2 - BE0477472701 - - - partner_2 - - - - - 30 - ___ignore___ - - BE15001559627230 - - - - Payment terms: 30% Advance End of Following Month - - - 959.07 - - 4567.00 - 959.07 - - S - 21.0 - - VAT - - - - - - 4567.00 - 4567.00 - 5526.07 - 0.00 - 5526.07 - - - ___ignore___ - 10000.0 - 4567.00 - - product_a - product_a - - S - 21.0 - - VAT - - - - - 0.4567 - - - diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_tax_exempt.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_tax_exempt.xml deleted file mode 100644 index fd4d6a6..0000000 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_tax_exempt.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 - urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - ___ignore___ - 2017-01-01 - 2017-02-28 - 380 - test narration - USD - ref_partner_2 - - ref_move - - - - BE0202239951 - - partner_1 - - - Chaussée de Namur 40 - Ramillies - 1367 - - BE - - - - BE0202239951 - - VAT - - - - partner_1 - BE0202239951 - - - partner_1 - - - - - - BE0477472701 - - partner_2 - - - Rue des Bourlottes 9 - Ramillies - 1367 - - BE - - - - BE0477472701 - - VAT - - - - partner_2 - BE0477472701 - - - partner_2 - - - - - 30 - ___ignore___ - - BE15001559627230 - - - - Payment terms: 30% Advance End of Following Month - - - 0.00 - - 990.00 - 0.00 - - E - 0.0 - Articles 226 items 11 to 15 Directive 2006/112/EN - - VAT - - - - - - 990.00 - 990.00 - 990.00 - 0.00 - 990.00 - - - 1 - 1.0 - 990.00 - - product_a - product_a - - E - 0.0 - - VAT - - - - - 990.0 - - - diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_refund.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_refund.xml index 2c7072d..d14f18c 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_refund.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_refund.xml @@ -7,13 +7,23 @@ 381 test narration USD + EUR ref_partner_2 ref_move + + ___ignore___ + + ___ignore___ + + - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -33,7 +43,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -42,7 +52,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -62,13 +75,30 @@ partner_2 - BE0477472701 + 0477472701 partner_2 + + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + + + partner_2 + + + 57 RINV/2017/01/0001 @@ -104,6 +134,9 @@ + + 241.11 + 2682.00 2682.00 @@ -118,7 +151,10 @@ false 95 + Discount + 10.0 198.00 + 1980.00 product_a diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_pay_term.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_pay_term.xml index ba33026..5f3a6bf 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_pay_term.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_pay_term.xml @@ -5,7 +5,7 @@ urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - INV/2017/00002 + ___ignore___ 2017-01-01 2017-01-31 380 @@ -15,9 +15,20 @@ ref_move + + ___ignore___ + + + ___ignore___ + + + - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -37,7 +48,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 @@ -46,7 +57,10 @@ - BE0477472701 + 0477472701 + + 0477472701 + partner_2 @@ -66,13 +80,30 @@ partner_2 - BE0477472701 + 0477472701 partner_2 + + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + + + partner_2 + + + 30 ___ignore___ diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_pay_term_ecotax.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_pay_term_ecotax.xml deleted file mode 100644 index 648dc78..0000000 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_pay_term_ecotax.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 - - urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - INV/2017/00002 - 2017-01-01 - 2017-01-31 - 380 - test narration - USD - ref_partner_2 - - ref_move - - - - BE0202239951 - - partner_1 - - - Chaussée de Namur 40 - Ramillies - 1367 - - BE - - - - BE0202239951 - - VAT - - - - partner_1 - BE0202239951 - - - partner_1 - - - - - - BE0477472701 - - partner_2 - - - Rue des Bourlottes 9 - Ramillies - 1367 - - BE - - - - BE0477472701 - - VAT - - - - partner_2 - BE0477472701 - - - partner_2 - - - - - 30 - ___ignore___ - - BE15001559627230 - - - - Payment terms: 30 Days, 2% Early Payment Discount under 7 days - - - false - 66 - Conditional cash/payment discount - 1.98 - - S - 21.0 - - VAT - - - - - true - ZZZ - Conditional cash/payment discount - 1.98 - - E - 0.0 - - VAT - - - - - 20.58 - - 98.02 - 20.58 - - S - 21.0 - - VAT - - - - - 1.98 - 0.00 - - E - 0.0 - Exempt from tax - - VAT - - - - - - 100.00 - 100.00 - 120.58 - 1.98 - 1.98 - 0.00 - 120.58 - - - ___ignore___ - 1.0 - 100.00 - - true - AEO - RECUPEL - 1.00 - - - product_a - product_a - - S - 21.0 - - VAT - - - - - 99.0 - - - diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case1.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case1.xml index 7e21005..c5bce90 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case1.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case1.xml @@ -65,7 +65,7 @@ +1 (650) 555-0111 - partner1@yourcompany.com + partner1@yourcompany.com @@ -133,6 +133,14 @@ 5 21.0 + + + 20170101 + + + 20170228 + + 30% Advance End of Following Month diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case2.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case2.xml index aa62240..42061d9 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case2.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case2.xml @@ -73,7 +73,7 @@ +1 (650) 555-0111 - partner1@yourcompany.com + partner1@yourcompany.com @@ -141,6 +141,14 @@ 5 21.0 + + + 20170101 + + + 20170228 + + 30% Advance End of Following Month diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case3.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case3.xml index 6c6a41a..0215d72 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case3.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_ecotaxes_case3.xml @@ -65,7 +65,7 @@ +1 (650) 555-0111 - partner1@yourcompany.com + partner1@yourcompany.com @@ -133,6 +133,14 @@ 5 21.0 + + + 20170101 + + + 20170228 + + 30% Advance End of Following Month diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_invoice.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_invoice.xml index 767017b..260f7ff 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_invoice.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_invoice.xml @@ -119,7 +119,7 @@ +1 (650) 555-0111 - partner1@yourcompany.com + partner1@yourcompany.com @@ -195,6 +195,14 @@ 5 12.0 + + + 20170101 + + + 20170228 + + 30% Advance End of Following Month diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_invoice_tax_incl.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_invoice_tax_incl.xml index 12d3b1b..944d432 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_invoice_tax_incl.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_invoice_tax_incl.xml @@ -154,7 +154,7 @@ +1 (650) 555-0111 - partner1@yourcompany.com + partner1@yourcompany.com @@ -222,6 +222,14 @@ 5 5.0 + + + 20170101 + + + 20170228 + + 30% Advance End of Following Month diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_refund.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_refund.xml index 8435292..f4a4b57 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_refund.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_out_refund.xml @@ -119,7 +119,7 @@ +1 (650) 555-0111 - partner1@yourcompany.com + partner1@yourcompany.com @@ -194,6 +194,14 @@ 5 12.0 + + + 20170101 + + + 20170228 + + 30% Advance End of Following Month diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_positive_discount_price_unit.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_positive_discount_price_unit.xml new file mode 100644 index 0000000..d4e96e2 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_positive_discount_price_unit.xml @@ -0,0 +1,179 @@ + + + + + urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended + + + + INV/2017/00001 + 380 + + 20170101 + + + test narration + + + + + + 1 + + + product_a + + + + 100.00 + + + 100.00 + + + + 1.0 + + + + VAT + S + 20.0 + + + 100.00 + + + + + + 2 + + + product_b + + + + 50.00 + + + 50.00 + + + + -1.0 + + + + VAT + S + 20.0 + + + -50.00 + + + + + ref_partner_2 + + partner_1 + + partner_1 + + +1 (650) 555-0111 + + + partner1@yourcompany.com + + + + 75000 + Rue Jean Jaurès, 42 + Paris + FR + + + FR05677404089 + + + + partner_2 + + partner_2 + + + 52330 + Rue Charles de Gaulle + Colombey-les-Deux-Églises + FR + + + FR35562153452 + + + + ref_move + + + + + partner_2 + + partner_2 + + + 52330 + Rue Charles de Gaulle + Colombey-les-Deux-Églises + FR + + + + + 20170101 + + + + + INV/2017/00001 + USD + + 42 + + FR15001559627230 + + + + 10.00 + VAT + 50.00 + S + 5 + 20.0 + + + + 20170101 + + + 20170228 + + + + 30% Advance End of Following Month + + 20170228 + + + + 50.00 + 50.00 + 10.00 + 60.00 + 0.00 + 60.00 + + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_test_import_partner.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_test_import_partner.xml index 1be1f99..af46d8a 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_test_import_partner.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/facturx_test_import_partner.xml @@ -51,7 +51,7 @@ +1 (650) 555-0111 - partner1@yourcompany.com + partner1@yourcompany.com @@ -72,7 +72,7 @@ 1111 - buyer@yahoo.com + buyer@yahoo.com @@ -92,7 +92,7 @@ 1111 - buyer@yahoo.com + buyer@yahoo.com diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/nlcius_out_invoice.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/nlcius_out_invoice.xml index e0e2029..f62c3a7 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/nlcius_out_invoice.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/nlcius_out_invoice.xml @@ -12,9 +12,18 @@ ref_move + + ___ignore___ + + ___ignore___ + + 77777677 + + ref_partner_1 + 77777677 @@ -48,9 +57,9 @@ - 1234567 + NL41452B11 - 1234567 + NL41452B11 partner_2 @@ -71,13 +80,30 @@ partner_2 - 1234567 + 123456789 partner_2 + + + + Europaweg, 2 + Rotterdam + 1200 + + NL + + + + + + partner_2 + + + 30 INV/2017/00002 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/nlcius_out_refund.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/nlcius_out_refund.xml index 5e6aeb6..4be8432 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/nlcius_out_refund.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/nlcius_out_refund.xml @@ -16,9 +16,18 @@ ref_move + + ___ignore___ + + ___ignore___ + + 77777677 + + ref_partner_1 + 77777677 @@ -52,9 +61,9 @@ - 1234567 + NL41452B11 - 1234567 + NL41452B11 partner_2 @@ -75,13 +84,30 @@ partner_2 - 1234567 + 123456789 partner_2 + + + + Europaweg, 2 + Rotterdam + 1200 + + NL + + + + + + partner_2 + + + 57 RINV/2017/00001 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/sg_out_invoice.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/sg_out_invoice.xml new file mode 100644 index 0000000..d62dcac --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/sg_out_invoice.xml @@ -0,0 +1,190 @@ + + + urn:cen.eu:en16931:2017#conformant#urn:fdc:peppol.eu:2017:poacc:billing:international:sg:3.0 + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + INV/2017/00001 + 2017-01-01 + 2017-02-28 + 380 + test narration + USD + ref_partner_2 + + ref_move + + + INV_2017_00001.pdf + + ___ignore___ + + + + + 197401143C + + ref_partner_1 + + + partner_1 + + + Tyersall Avenue + Central Singapore + 248048 + + SG + + + + 197401143C + + GST + + + + partner_1 + 197401143C + + + partner_1 + +65 9123 4567 + info@outlook.sg + + + + + + S16FC0121D + + ref_partner_2 + + + partner_2 + + + that other street, 3 + East Singapore + 248050 + + SG + + + + S16FC0121D + + GST + + + + partner_2 + S16FC0121D + + + partner_2 + +65 9123 4589 + + + + + + + that other street, 3 + East Singapore + 248050 + + SG + + + + + + partner_2 + + + + + 54 + INV/2017/00001 + + 000099998B57 + + + + Payment terms: 30% Advance End of Following Month + + + 160.00 + + 1600.00 + 160.00 + + SR + 10.0 + + GST + + + + + 1000.00 + 0.00 + + ZR + 0.0 + + GST + + + + + + 2600.00 + 2600.00 + 2760.00 + 0.00 + 2760.00 + + + 1 + 2.0 + 1600.00 + + false + 95 + 400.00 + + + product_a + product_a + + SR + 10.0 + + GST + + + + + 1000.0 + + + + 2 + 2.0 + 1000.00 + + product_b + product_b + + ZR + 0.0 + + GST + + + + + 500.0 + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/sg_out_refund.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/sg_out_refund.xml new file mode 100644 index 0000000..f519ed4 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/sg_out_refund.xml @@ -0,0 +1,189 @@ + + + urn:cen.eu:en16931:2017#conformant#urn:fdc:peppol.eu:2017:poacc:billing:international:sg:3.0 + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + RINV/2017/00001 + 2017-01-01 + 381 + test narration + USD + ref_partner_2 + + ref_move + + + RINV_2017_00001.pdf + + ___ignore___ + + + + + 197401143C + + ref_partner_1 + + + partner_1 + + + Tyersall Avenue + Central Singapore + 248048 + + SG + + + + 197401143C + + GST + + + + partner_1 + 197401143C + + + partner_1 + +65 9123 4567 + info@outlook.sg + + + + + + S16FC0121D + + ref_partner_2 + + + partner_2 + + + that other street, 3 + East Singapore + 248050 + + SG + + + + S16FC0121D + + GST + + + + partner_2 + S16FC0121D + + + partner_2 + +65 9123 4589 + + + + + + + that other street, 3 + East Singapore + 248050 + + SG + + + + + + partner_2 + + + + + 54 + RINV/2017/00001 + + 93999574162167 + + + + Payment terms: 30% Advance End of Following Month + + + 160.00 + + 1600.00 + 160.00 + + SR + 10.0 + + GST + + + + + 1000.00 + 0.00 + + ZR + 0.0 + + GST + + + + + + 2600.00 + 2600.00 + 2760.00 + 0.00 + 2760.00 + + + 1 + 2.0 + 1600.00 + + false + 95 + 400.00 + + + product_a + product_a + + SR + 10.0 + + GST + + + + + 1000.0 + + + + 2 + 2.0 + 1000.00 + + product_b + product_b + + ZR + 0.0 + + GST + + + + + 500.0 + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/ubl_test_import_partner.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/ubl_test_import_partner.xml index a742e5e..a97254a 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/ubl_test_import_partner.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/ubl_test_import_partner.xml @@ -17,7 +17,10 @@ - BE0202239951 + 0202239951 + + 0202239951 + partner_1 @@ -37,7 +40,7 @@ partner_1 - BE0202239951 + 0202239951 partner_1 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_invoice.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_invoice.xml index 0a05277..a5739bb 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_invoice.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_invoice.xml @@ -8,13 +8,22 @@ 380 test narration USD - ref_partner_2 + 123456789 ref_move + + ___ignore___ + + ___ignore___ + + DE257486969 + + ref_partner_1 + partner_1 @@ -45,7 +54,10 @@ - DE186775212 + 123456789 + + ref_partner_2 + partner_2 @@ -72,6 +84,24 @@ + + 2017-01-01 + + + Europa-Park-Straße 2 + Rust + 77977 + + DE + + + + + + partner_2 + + + 30 INV/2017/01/0002 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_invoice_without_vat.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_invoice_without_vat.xml deleted file mode 100644 index 042c818..0000000 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_invoice_without_vat.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0 - urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - INV/2017/01/0002 - 2017-01-01 - 2017-02-28 - 380 - test narration - USD - ref_partner_2 - - ref_move - - - - DE257486969 - - partner_1 - - - Legoland-Allee 3 - Günzburg - 89312 - - DE - - - - DE257486969 - - VAT - - - - partner_1 - DE257486969 - - - partner_1 - +49 180 6 225789 - info@legoland.de - - - - - - partner_2@test.test - - partner_2 - - - Europa-Park-Straße 2 - Rust - 77977 - - DE - - - - partner_2 - - - partner_2 - partner_2@test.test - - - - - 30 - INV/2017/01/0002 - - DE48500105176424548921 - - - - Payment terms: 30% Advance End of Following Month - - - 19.00 - - 100.00 - 19.00 - - S - 19.0 - - VAT - - - - - - 100.00 - 100.00 - 119.00 - 0.00 - 119.00 - - - 1708 - 1.0 - 100.00 - - product_a - product_a - - S - 19.0 - - VAT - - - - - 100.0 - - - diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_refund.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_refund.xml index a4e1a91..ee57fb8 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_refund.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/xrechnung_ubl_out_refund.xml @@ -7,13 +7,22 @@ 381 test narration USD - ref_partner_2 + 123456789 ref_move + + ___ignore___ + + ___ignore___ + + DE257486969 + + ref_partner_1 + partner_1 @@ -44,7 +53,10 @@ - DE186775212 + 123456789 + + ref_partner_2 + partner_2 @@ -71,6 +83,24 @@ + + 2017-01-01 + + + Europa-Park-Straße 2 + Rust + 77977 + + DE + + + + + + partner_2 + + + 57 RINV/2017/01/0001 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_invoice.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_invoice.xml new file mode 100644 index 0000000..237dd17 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_invoice.xml @@ -0,0 +1,222 @@ + + + + + urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p2:extended + + + + INV/2017/00001 + 380 + + 20170101 + + + test narration + + + + + + 1 + + + product_a + + + + 990.00 + + + false + + 99.00 + + + + 891.00 + + + + 2.0 + + + + VAT + S + 19.0 + + + 1782.00 + + + + + + 2 + + + product_b + + + + 100.00 + + + 100.00 + + + + 10.0 + + + + VAT + S + 7.0 + + + 1000.00 + + + + + + 3 + + + product_b + + + + 100.00 + + + 100.00 + + + + -1.0 + + + + VAT + S + 7.0 + + + -100.00 + + + + + ref_partner_2 + + partner_1 + + partner_1 + + +49 180 6 225789 + + + info@legoland.de + + + + 89312 + Legoland-Allee 3 + Günzburg + DE + + + DE257486969 + + + + partner_2 + + partner_2 + + + 77977 + Europa-Park-Straße 2 + Rust + DE + + + DE186775212 + + + + ref_move + + + + + partner_2 + + partner_2 + + + 77977 + Europa-Park-Straße 2 + Rust + DE + + + + + 20170101 + + + + + INV/2017/00001 + USD + + 42 + + DE48500105176424548921 + + + + 338.58 + VAT + 1782.00 + S + 5 + 19.0 + + + 63.00 + VAT + 900.00 + S + 5 + 7.0 + + + + 20170101 + + + 20170228 + + + + 30% Advance End of Following Month + + 20170228 + + + + 2682.00 + 2682.00 + 401.58 + 3083.58 + 0.00 + 3083.58 + + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_invoice_without_vat.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_invoice_without_vat.xml new file mode 100644 index 0000000..3181c92 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_invoice_without_vat.xml @@ -0,0 +1,153 @@ + + + + + urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p2:extended + + + + INV/2017/00001 + 380 + + 20170101 + + + test narration + + + + + + 1 + + + product_a + + + + 100.00 + + + 100.00 + + + + 1.0 + + + + VAT + S + 19.0 + + + 100.00 + + + + + ref_partner_2 + + partner_1 + + partner_1 + + +49 180 6 225789 + + + info@legoland.de + + + + 89312 + Legoland-Allee 3 + Günzburg + DE + + + DE257486969 + + + + partner_2 + + partner_2 + + partner_2@test.test + + + + 77977 + Europa-Park-Straße 2 + Rust + DE + + + + ref_move + + + + + partner_2 + + partner_2 + + partner_2@test.test + + + + 77977 + Europa-Park-Straße 2 + Rust + DE + + + + + 20170101 + + + + + INV/2017/00001 + USD + + 42 + + DE48500105176424548921 + + + + 19.00 + VAT + 100.00 + S + 5 + 19.0 + + + + 20170101 + + + 20170228 + + + + 30% Advance End of Following Month + + 20170228 + + + + 100.00 + 100.00 + 19.00 + 119.00 + 0.00 + 119.00 + + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_refund.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_refund.xml new file mode 100644 index 0000000..bb924ab --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/zugferd_out_refund.xml @@ -0,0 +1,221 @@ + + + + + urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p2:extended + + + + RINV/2017/00001 + 381 + + 20170101 + + + test narration + + + + + + 1 + + + product_a + + + + 990.00 + + + false + + 99.00 + + + + 891.00 + + + + 2.0 + + + + VAT + S + 19.0 + + + 1782.00 + + + + + + 2 + + + product_b + + + + 100.00 + + + 100.00 + + + + 10.0 + + + + VAT + S + 7.0 + + + 1000.00 + + + + + + 3 + + + product_b + + + + 100.00 + + + 100.00 + + + + -1.0 + + + + VAT + S + 7.0 + + + -100.00 + + + + + ref_partner_2 + + partner_1 + + partner_1 + + +49 180 6 225789 + + + info@legoland.de + + + + 89312 + Legoland-Allee 3 + Günzburg + DE + + + DE257486969 + + + + partner_2 + + partner_2 + + + 77977 + Europa-Park-Straße 2 + Rust + DE + + + DE186775212 + + + + ref_move + + + + + partner_2 + + partner_2 + + + 77977 + Europa-Park-Straße 2 + Rust + DE + + + + + 20170101 + + + + + USD + + 42 + + DE50500105175653254743 + + + + 338.58 + VAT + 1782.00 + S + 5 + 19.0 + + + 63.00 + VAT + 900.00 + S + 5 + 7.0 + + + + 20170101 + + + 20170228 + + + + 30% Advance End of Following Month + + 20170228 + + + + 2682.00 + 2682.00 + 401.58 + 3083.58 + 0.00 + 3083.58 + + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_peppol-bis-invoice-3_doc/bis3_allowance.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_peppol-bis-invoice-3_doc/bis3_allowance.xml index a7e137d..5dfd549 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_peppol-bis-invoice-3_doc/bis3_allowance.xml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_peppol-bis-invoice-3_doc/bis3_allowance.xml @@ -23,7 +23,6 @@ DR35141 - 130 ts12345 diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_peppol-bis-invoice-3_doc/bis3_invoice_ignore_lineextensionamount.xml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_peppol-bis-invoice-3_doc/bis3_invoice_ignore_lineextensionamount.xml new file mode 100644 index 0000000..ba59e73 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_files/from_peppol-bis-invoice-3_doc/bis3_invoice_ignore_lineextensionamount.xml @@ -0,0 +1,43 @@ + + + urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + Correction1 + 2017-11-13 + 2017-12-01 + 380 + EUR + + + 1 + 1 + + + Empty line extension amount + Item empty + + + + + 2 + 1 + 0 + + Zero line extension amount + Item zero + + + + + 3 + 1 + 1000 + + Non zero line extension amount + Item with price + + + + diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_fr.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_fr.py index 14ef99c..bed4642 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_fr.py +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_fr.py @@ -7,11 +7,9 @@ from odoo.tests import tagged class TestCIIFR(TestUBLCommon): @classmethod - def setUpClass(cls, - chart_template_ref="l10n_fr.l10n_fr_pcg_chart_template", - edi_format_ref="account_edi_ubl_cii.edi_facturx_1_0_05", - ): - super().setUpClass(chart_template_ref=chart_template_ref, edi_format_ref=edi_format_ref) + @TestUBLCommon.setup_country('fr') + def setUpClass(cls): + super().setUpClass() cls.partner_1 = cls.env['res.partner'].create({ 'name': "partner_1", @@ -20,10 +18,11 @@ class TestCIIFR(TestUBLCommon): 'city': "Paris", 'vat': 'FR05677404089', 'country_id': cls.env.ref('base.fr').id, - 'bank_ids': [(0, 0, {'acc_number': 'FR15001559627230'})], + 'bank_ids': [(0, 0, {'acc_number': 'FR15001559627230', 'allow_out_payment': True})], 'phone': '+1 (650) 555-0111', 'email': "partner1@yourcompany.com", 'ref': 'ref_partner_1', + 'invoice_edi_format': 'facturx', }) cls.partner_2 = cls.env['res.partner'].create({ @@ -33,8 +32,9 @@ class TestCIIFR(TestUBLCommon): 'city': "Colombey-les-Deux-Églises", 'vat': 'FR35562153452', 'country_id': cls.env.ref('base.fr').id, - 'bank_ids': [(0, 0, {'acc_number': 'FR90735788866632'})], + 'bank_ids': [(0, 0, {'acc_number': 'FR90735788866632', 'allow_out_payment': True})], 'ref': 'ref_partner_2', + 'invoice_edi_format': 'facturx', }) cls.tax_21 = cls.env['account.tax'].create({ @@ -96,21 +96,18 @@ class TestCIIFR(TestUBLCommon): 'amount_type': 'percent', 'amount': 5, 'type_tax_use': 'sale', - 'price_include': True, + 'price_include_override': 'tax_included', }) @classmethod - def setup_company_data(cls, company_name, chart_template): - # OVERRIDE - # to force the company to be french - res = super().setup_company_data( - company_name, - chart_template=chart_template, - country_id=cls.env.ref("base.fr").id, + def setup_independent_company(cls, **kwargs): + return super().setup_independent_company( phone='+1 (650) 555-0111', # [BR-DE-6] "Seller contact telephone number" (BT-42) is required email="info@yourcompany.com", # [BR-DE-7] The element "Seller contact email address" (BT-43) is required + vat='FR23334175221', # [BR-CO-26]-In order for the buyer to automatically ... + zip='123', # [BR-DE-4] The element "Seller post code" (BT-38) must be transmitted. + **kwargs, ) - return res #################################################### # Test export - import @@ -120,27 +117,27 @@ class TestCIIFR(TestUBLCommon): acc_bank = self.env['res.partner.bank'].create({ 'acc_number': 'FR15001559627231', 'partner_id': self.company_data['company'].partner_id.id, + 'allow_out_payment': True, }) - invoice = self.env['account.move'].create({ - 'move_type': 'out_invoice', - 'journal_id': self.journal.id, - 'partner_id': self.partner_1.id, - 'partner_bank_id': acc_bank.id, - 'invoice_date': '2017-01-01', - 'date': '2017-01-01', - 'currency_id': self.currency_data['currency'].id, - 'invoice_line_ids': [(0, 0, { + + invoice = self._generate_move( + self.partner_1, + self.partner_2, + move_type='out_invoice', + partner_bank_id=acc_bank.id, + invoice_line_ids=[{ 'product_id': self.product_a.id, 'product_uom_id': self.env.ref('uom.product_uom_dozen').id, 'price_unit': 275.0, 'quantity': 5, 'discount': 20.0, 'tax_ids': [(6, 0, self.tax_21.ids)], - })], - }) - invoice.action_post() - pdf_attachment = invoice._get_edi_attachment(self.edi_format) - self.assertEqual(pdf_attachment['name'], 'factur-x.xml') + }], + ) + + pdf_attachment = invoice.ubl_cii_xml_id + 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( @@ -173,21 +170,22 @@ class TestCIIFR(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - invoice, + invoice.ubl_cii_xml_id, xpaths=''' - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___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") + 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): @@ -221,18 +219,19 @@ class TestCIIFR(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - refund, + refund.ubl_cii_xml_id, xpaths=''' - ___ignore___ + ___ignore___ - ___ignore___ + ___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") + 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): @@ -274,20 +273,27 @@ class TestCIIFR(TestUBLCommon): ], ) self._assert_invoice_attachment( - invoice, + invoice.ubl_cii_xml_id, xpaths=''' - ___ignore___ + ___ignore___ - ___ignore___ + ___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): - self._test_encoding_in_attachment('facturx_1_0_05', 'factur-x.xml') + invoice = self._generate_move( + seller=self.partner_1, + buyer=self.partner_2, + move_type='out_invoice', + invoice_line_ids=[{'product_id': self.product_a.id}], + ) + 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 @@ -305,7 +311,7 @@ class TestCIIFR(TestUBLCommon): ], ) self.assertEqual(invoice.amount_total, 121) - self._assert_invoice_attachment(invoice, None, 'from_odoo/facturx_ecotaxes_case1.xml') + self._assert_invoice_attachment(invoice.ubl_cii_xml_id, None, 'from_odoo/facturx_ecotaxes_case1.xml') def test_export_with_fixed_taxes_case2(self): # CASE 2: Same but with several ecotaxes @@ -323,12 +329,12 @@ class TestCIIFR(TestUBLCommon): ], ) self.assertEqual(invoice.amount_total, 121) - self._assert_invoice_attachment(invoice, None, 'from_odoo/facturx_ecotaxes_case2.xml') + self._assert_invoice_attachment(invoice.ubl_cii_xml_id, None, 'from_odoo/facturx_ecotaxes_case2.xml') def test_export_with_fixed_taxes_case3(self): # CASE 3: same as Case 1 but taxes are Price Included - self.recupel.price_include = True - self.tax_21.price_include = True + self.recupel.price_include_override = 'tax_included' + self.tax_21.price_include_override = 'tax_included' # Price TTC = 121 = (99 + 1 ) * 1.21 invoice = self._generate_move( @@ -345,62 +351,45 @@ class TestCIIFR(TestUBLCommon): ], ) self.assertEqual(invoice.amount_total, 121) - self._assert_invoice_attachment(invoice, None, 'from_odoo/facturx_ecotaxes_case3.xml') + self._assert_invoice_attachment(invoice.ubl_cii_xml_id, None, 'from_odoo/facturx_ecotaxes_case3.xml') #################################################### # Test import #################################################### def test_import_partner_facturx(self): - """ - Given an invoice where partner_1 is the vendor and partner_2 is the customer with an EDI attachment. - * Uploading the attachment as an invoice should create an invoice with the buyer = partner_2. - * Uploading the attachment as a vendor bill should create a bill with the vendor = partner_1. - """ invoice = self._generate_move( seller=self.partner_1, buyer=self.partner_2, move_type='out_invoice', invoice_line_ids=[{'product_id': self.product_a.id}], ) - new_invoice = self._import_invoice_attachment(invoice, 'facturx_1_0_05', self.company_data['default_journal_sale']) - self.assertEqual(self.partner_2, new_invoice.partner_id) + self._test_import_partner(invoice.ubl_cii_xml_id, self.partner_1, self.partner_2) - new_invoice = self._import_invoice_attachment(invoice, 'facturx_1_0_05', self.company_data['default_journal_purchase']) - self.assertEqual(self.partner_1, new_invoice.partner_id) - - def test_import_journal_facturx(self): - """ - If the context contains the info about the current default journal, we should use it - instead of infering the journal from the move type. - """ - journal2 = self.company_data['default_journal_sale'].copy() - journal2.default_account_id = self.company_data['default_account_revenue'].id + def test_import_in_journal_facturx(self): invoice = self._generate_move( seller=self.partner_1, buyer=self.partner_2, move_type='out_invoice', invoice_line_ids=[{'product_id': self.product_a.id}], ) - edi_attachment = invoice._get_edi_attachment(self.env.ref('account_edi_ubl_cii.edi_facturx_1_0_05')).id - - new_invoice = self.env['account.journal'].with_context(default_move_type='out_invoice')._create_document_from_attachment(edi_attachment) - self.assertEqual(new_invoice.journal_id, self.company_data['default_journal_sale']) - - new_invoice = self.env['account.journal'].with_context(default_journal_id=journal2.id)._create_document_from_attachment(edi_attachment) - self.assertEqual(new_invoice.journal_id, journal2) + self._test_import_in_journal(invoice.ubl_cii_xml_id) def test_import_and_create_partner_facturx(self): """ Tests whether the partner is created at import if no match is found when decoding the EDI attachment """ + self.env['res.partner.bank'].sudo().create({ + 'acc_number': 'FR15001559627230', + 'partner_id': self.company_data['company'].partner_id.id, + }) partner_vals = { 'name': "Buyer", - 'mail': "buyer@yahoo.com", + 'email': "buyer@yahoo.com", 'phone': "1111", 'vat': "FR89215010646", } # assert there is no matching partner - partner_match = self.env['account.edi.format']._retrieve_partner(**partner_vals) + partner_match = self.env['res.partner']._retrieve_partner(**partner_vals) self.assertFalse(partner_match) # Import attachment as an invoice @@ -408,14 +397,13 @@ class TestCIIFR(TestUBLCommon): 'move_type': 'out_invoice', 'journal_id': self.company_data['default_journal_sale'].id, }) - self.update_invoice_from_file( + self._update_invoice_from_file( module_name='l10n_account_edi_ubl_cii_tests', subfolder='tests/test_files/from_odoo', filename='facturx_test_import_partner.xml', invoice=invoice) # assert a new partner has been created - partner_vals['email'] = partner_vals.pop('mail') self.assertRecordValues(invoice.partner_id, [partner_vals]) def test_import_tax_included(self): @@ -435,62 +423,127 @@ class TestCIIFR(TestUBLCommon): ----------------------- Total: 574.004 """ + # /!\ The price_unit are different for taxes with price_include, because all amounts in Factur-X should be + # tax excluded. At import, the tax included amounts are thus converted into tax excluded ones. + # Yet, the line subtotals and total will be the same (if an equivalent tax exist with price_include = False) + invoice_vals = { + 'amount_total': 574.004, + 'amount_tax': 27.334, + 'currency_id': self.env['res.currency'].search([('name', '=', 'USD')], limit=1).id, + 'invoice_lines': [ + {'price_unit': 95.24, 'price_subtotal': 95.24, 'quantity': 1, 'discount': 0, 'tax_ids': self.tax_5_purchase.ids}, + {'price_unit': 100, 'price_subtotal': 100, 'quantity': 1, 'discount': 0, 'tax_ids': self.tax_5_purchase.ids}, + {'price_unit': 190.48, 'price_subtotal': 171.43, 'quantity': 1, 'discount': 10.001049979000411, 'tax_ids': self.tax_5_purchase.ids}, + {'price_unit': 200, 'price_subtotal': 180, 'quantity': 1, 'discount': 10.0, 'tax_ids': self.tax_5_purchase.ids}, + ] + } self._assert_imported_invoice_from_file( subfolder='tests/test_files/from_odoo', filename='facturx_out_invoice_tax_incl.xml', - amount_total=574.004, - amount_tax=27.334, - list_line_subtotals=[95.24, 100, 171.43, 180], - # /!\ The price_unit are different for taxes with price_include, because all amounts in Factur-X should be - # tax excluded. At import, the tax included amounts are thus converted into tax excluded ones. - # Yet, the line subtotals and total will be the same (if an equivalent tax exist with price_include = False) - list_line_price_unit=[95.24, 100, 190.48, 200], - # rounding error since for line 3: we round several times... - # when exporting the invoice, we compute the price tax excluded = 200/1.05 ~= 190.48 + # Discount of line 3: when exporting the invoice, we compute the price tax excluded = 200/1.05 ~= 190.48 # then, when computing the discount amount: 190.48 * 0.1 ~= 19.05 => price net amount = 171.43 # Thus, at import: price_unit = 190.48, and discount = 100 * (1 - 171.43 / 190.48) = 10.001049979 - list_line_discount=[0, 0, 10, 10], - # Again, all taxes in the imported invoice are price_include = False - list_line_taxes=[self.tax_5_purchase]*4, move_type='in_invoice', - currency_id=self.env['res.currency'].search([('name', '=', 'USD')], limit=1).id, + invoice_vals=invoice_vals, ) def test_import_fnfe_examples(self): + self.env['res.partner.bank'].sudo().create({ + 'acc_number': 'FR76 1254 2547 2569 8542 5874 698', + 'partner_id': self.company_data['company'].partner_id.id, + }) # Source: official documentation of the FNFE (subdirectory: "5. FACTUR-X 1.0.06 - Examples") subfolder = 'tests/test_files/from_factur-x_doc' # the 2 following files have the same pdf but one is labelled as an invoice and the other as a refund + invoice_vals = { + 'amount_total': 233.47, + 'amount_tax': 14.99, + 'invoice_lines': [{'price_subtotal': 20.48}, {'price_subtotal': 198}] + } # source: Avoir_FR_type380_EN16931.pdf - self._assert_imported_invoice_from_file(subfolder=subfolder, filename='facturx_credit_note_type380.xml', - amount_total=233.47, amount_tax=14.99, list_line_subtotals=[20.48, 198], move_type='in_refund') + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='facturx_credit_note_type380.xml', + invoice_vals=invoice_vals, + move_type='in_refund', + ) # source: Avoir_FR_type381_EN16931.pdf - self._assert_imported_invoice_from_file(subfolder=subfolder, filename='facturx_credit_note_type381.xml', - amount_total=233.47, amount_tax=14.99, list_line_subtotals=[20.48, 198], move_type='in_refund') + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='facturx_credit_note_type381.xml', + invoice_vals=invoice_vals, + move_type='in_refund', + ) # source: Facture_F20220024_EN_16931_basis_quantity, basis quantity != 1 for one of the lines - self._assert_imported_invoice_from_file(subfolder=subfolder, filename='facturx_invoice_basis_quantity.xml', - amount_total=108, amount_tax=8, list_line_subtotals=[-5, 10, 60, 28, 7]) + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='facturx_invoice_basis_quantity.xml', + invoice_vals={'amount_total': 108, 'amount_tax': 8}, + ) # source: Facture_F20220029_EN_16931_K.pdf, credit note labelled as an invoice with negative amounts - self._assert_imported_invoice_from_file(subfolder=subfolder, filename='facturx_invoice_negative_amounts.xml', - amount_total=100, amount_tax=0, list_line_subtotals=[-5, 10, 60, 30, 5], move_type='in_refund') + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='facturx_invoice_negative_amounts.xml', + invoice_vals={ + 'amount_total': 100, + 'amount_tax': 0, + 'invoice_lines': [{'price_subtotal': p} for p in (-5, 10, 60, 30, 5)], + }, + move_type='in_refund', + ) def test_import_fixed_taxes(self): """ Tests whether we correctly decode the xml attachments created using fixed taxes. See the tests above to create these xml attachments ('test_export_with_fixed_taxes_case_[X]'). NB: use move_type = 'out_invoice' s.t. we can retrieve the taxes used to create the invoices. """ + self.env['res.partner.bank'].sudo().create({ + 'acc_number': 'FR15001559627230', + 'partner_id': self.company_data['company'].partner_id.id, + }) subfolder = "tests/test_files/from_odoo" - self._assert_imported_invoice_from_file( - subfolder=subfolder, filename='facturx_ecotaxes_case1.xml', amount_total=121, amount_tax=22, - list_line_subtotals=[99], currency_id=self.currency_data['currency'].id, list_line_price_unit=[99], - list_line_discount=[0], list_line_taxes=[self.tax_21+self.recupel], move_type='out_invoice', - ) - self._assert_imported_invoice_from_file( - subfolder=subfolder, filename='facturx_ecotaxes_case2.xml', amount_total=121, amount_tax=23, - list_line_subtotals=[98], currency_id=self.currency_data['currency'].id, list_line_price_unit=[98], - list_line_discount=[0], list_line_taxes=[self.tax_21+self.recupel+self.auvibel], move_type='out_invoice', - ) - self._assert_imported_invoice_from_file( - subfolder=subfolder, filename='facturx_ecotaxes_case3.xml', amount_total=121, amount_tax=22, - list_line_subtotals=[99], currency_id=self.currency_data['currency'].id, list_line_price_unit=[99], - list_line_discount=[0], list_line_taxes=[self.tax_21+self.recupel], move_type='out_invoice', + kwargs = { + 'subfolder': subfolder, + 'move_type': 'out_invoice', + 'invoice_vals': { + 'amount_total': 121, + 'amount_tax': 22, + 'currency_id': self.other_currency.id, + 'invoice_lines': [{ + 'name': "product_a", + 'quantity': 1, + 'price_unit': 99, + 'discount': 0, + 'tax_ids': (self.tax_21 + self.recupel).ids, + }], + }, + } + self._assert_imported_invoice_from_file(filename='facturx_ecotaxes_case1.xml', **kwargs) + self._assert_imported_invoice_from_file(filename='facturx_ecotaxes_case3.xml', **kwargs) + kwargs['invoice_vals'].update({ + 'amount_tax': 23, + 'invoice_lines': [{ + 'name': "product_a", + 'quantity': 1, + 'price_unit': 98, + 'discount': 0, + 'tax_ids': (self.tax_21 + self.recupel + self.auvibel).ids, + }], + }) + self._assert_imported_invoice_from_file(filename='facturx_ecotaxes_case2.xml', **kwargs) + + def test_facturx_has_no_negative_lines(self): + """ + Test that the is no negative ChargeAmount in the facturx xml + """ + invoice = self._generate_move( + seller=self.partner_1, + buyer=self.partner_2, + move_type='out_invoice', + invoice_line_ids=[ + {'product_id': self.product_a.id, 'quantity': 1, 'price_unit': 100.0, 'tax_ids': [(6, 0, [self.tax_sale_a.id])]}, + {'product_id': self.product_b.id, 'quantity': 1, 'price_unit': -50.0, 'tax_ids': [(6, 0, [self.tax_sale_a.id])]} + ] ) + + self._assert_invoice_attachment(invoice.ubl_cii_xml_id, None, 'from_odoo/facturx_positive_discount_price_unit.xml') diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_us.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_us.py index 321395b..3e94a51 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_us.py +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_cii_us.py @@ -7,11 +7,8 @@ from odoo.tests import tagged class TestCIIUS(TestUBLCommon): @classmethod - def setUpClass(cls, - chart_template_ref=None, - edi_format_ref="account_edi_ubl_cii.edi_facturx_1_0_05", - ): - super().setUpClass(chart_template_ref=chart_template_ref, edi_format_ref=edi_format_ref) + def setUpClass(cls): + super().setUpClass() cls.partner_1 = cls.env['res.partner'].create({ 'name': "partner_1", @@ -29,16 +26,6 @@ class TestCIIUS(TestUBLCommon): 'amount': 0, }) - @classmethod - def setup_company_data(cls, company_name, chart_template): - # OVERRIDE - res = super().setup_company_data( - company_name, - chart_template=chart_template, - country_id=cls.env.ref("base.us").id, - ) - return res - def test_print_pdf_us_company(self): """ Even for a US company, a printed PDF should contain a Factur-X xml """ @@ -54,25 +41,29 @@ class TestCIIUS(TestUBLCommon): }, ], ) - collected_streams = self.env['ir.actions.report']._render_qweb_pdf_prepare_streams( - report_ref='account.report_invoice_with_payments', - data=None, - res_ids=invoice.ids, - ) - self.assertTrue( - bytes(" - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ + + + application/pdf + {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) @@ -144,25 +138,29 @@ class TestUBLAU(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - refund, - xpaths=''' + refund.ubl_cii_xml_id, + xpaths=f''' - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ + + + application/pdf + {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) @@ -175,8 +173,10 @@ class TestUBLAU(TestUBLCommon): self._assert_imported_invoice_from_file( subfolder='tests/test_files/from_odoo', filename='a_nz_out_invoice.xml', - amount_total=2950.2, - amount_tax=268.2, - list_line_subtotals=[1782, 1000, -100], - currency_id=self.currency_data['currency'].id + invoice_vals={ + 'currency_id': self.other_currency.id, + 'amount_total': 2950.2, + 'amount_tax': 268.2, + 'invoice_lines': [{'price_subtotal': x} for x in (1782, 1000, -100)] + }, ) diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py index 89035ab..d9d32f1 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py @@ -1,21 +1,21 @@ -# -*- coding: utf-8 -*- import base64 from lxml import etree -from odoo.addons.l10n_account_edi_ubl_cii_tests.tests.common import TestUBLCommon -from odoo.tests import tagged from odoo import Command +from odoo.addons.l10n_account_edi_ubl_cii_tests.tests.common import TestUBLCommon +from odoo.addons.account.tests.test_account_move_send import TestAccountMoveSendCommon +from odoo.tests import tagged @tagged('post_install_l10n', 'post_install', '-at_install') -class TestUBLBE(TestUBLCommon): +class TestUBLBE(TestUBLCommon, TestAccountMoveSendCommon): @classmethod - def setUpClass(cls, - chart_template_ref="l10n_be.l10nbe_chart_template", - edi_format_ref="account_edi_ubl_cii.ubl_bis3", - ): - super().setUpClass(chart_template_ref=chart_template_ref, edi_format_ref=edi_format_ref) + @TestUBLCommon.setup_country("be") + def setUpClass(cls): + super().setUpClass() + + cls.company.vat = "BE0246697724" # seller cls.partner_1 = cls.env['res.partner'].create({ @@ -25,8 +25,9 @@ class TestUBLBE(TestUBLCommon): 'city': "Ramillies", 'vat': 'BE0202239951', 'country_id': cls.env.ref('base.be').id, - 'bank_ids': [(0, 0, {'acc_number': 'BE15001559627230'})], + 'bank_ids': [(0, 0, {'acc_number': 'BE15001559627230', 'allow_out_payment': True})], 'ref': 'ref_partner_1', + 'invoice_edi_format': 'ubl_bis3', }) # buyer @@ -37,8 +38,9 @@ class TestUBLBE(TestUBLCommon): 'city': "Ramillies", 'vat': 'BE0477472701', 'country_id': cls.env.ref('base.be').id, - 'bank_ids': [(0, 0, {'acc_number': 'BE90735788866632'})], + 'bank_ids': [(0, 0, {'acc_number': 'BE90735788866632', 'allow_out_payment': True})], 'ref': 'ref_partner_2', + 'invoice_edi_format': 'ubl_bis3', }) cls.tax_25 = cls.env['account.tax'].create({ @@ -90,47 +92,21 @@ class TestUBLBE(TestUBLCommon): 'country_id': cls.env.ref('base.be').id, }) - cls.acc_bank = cls.env['res.partner.bank'].create({ - 'acc_number': 'BE15001559627231', + cls.env['res.partner.bank'].sudo().create({ + 'acc_number': 'BE15001559627230', 'partner_id': cls.company_data['company'].partner_id.id, }) - cls.invoice = cls.env['account.move'].create({ - 'move_type': 'out_invoice', - 'journal_id': cls.journal.id, - 'partner_id': cls.partner_1.id, - 'partner_bank_id': cls.acc_bank.id, - 'invoice_date': '2017-01-01', - 'date': '2017-01-01', - 'currency_id': cls.currency_data['currency'].id, - 'invoice_line_ids': [(0, 0, { - 'product_id': cls.product_a.id, - 'product_uom_id': cls.env.ref('uom.product_uom_dozen').id, - 'price_unit': 275.0, - 'quantity': 5, - 'discount': 20.0, - 'tax_ids': [(6, 0, cls.tax_21.ids)], - })], - }) - cls.pay_term = cls.env['account.payment.term'].create({ 'name': "2/7 Net 30", 'note': "Payment terms: 30 Days, 2% Early Payment Discount under 7 days", + 'early_discount': True, + 'discount_percentage': 2, + 'discount_days': 7, 'line_ids': [ - Command.create({'value': 'balance', 'days': 30, 'discount_percentage': 2, 'discount_days': 7})], + Command.create({'value': 'percent', 'value_amount': 100.0, 'nb_days': 30})], }) - @classmethod - def setup_company_data(cls, company_name, chart_template): - # OVERRIDE - # to force the company to be belgian - res = super().setup_company_data( - company_name, - chart_template=chart_template, - country_id=cls.env.ref("base.be").id, - vat="BE0246697724") - return res - #################################################### # Test export - import #################################################### @@ -140,6 +116,7 @@ class TestUBLBE(TestUBLCommon): self.partner_1, self.partner_2, move_type='out_invoice', + delivery_date='2017-01-15', invoice_line_ids=[ { 'product_id': self.product_a.id, @@ -166,27 +143,31 @@ class TestUBLBE(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - invoice, - xpaths=''' + invoice.ubl_cii_xml_id, + xpaths=f''' - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ + + + application/pdf + {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") # ensure we test the right format ! + self.assertEqual(attachment.name[-12:], "ubl_bis3.xml") self._assert_imported_invoice_from_etree(invoice, attachment) def test_export_import_refund(self): @@ -220,387 +201,75 @@ class TestUBLBE(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - refund, - xpaths=''' + refund.ubl_cii_xml_id, + xpaths=f''' - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ + + + application/pdf + {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) def test_encoding_in_attachment_ubl(self): - self._test_encoding_in_attachment('ubl_bis3', 'INV_2017_00002_ubl_bis3.xml') - - def test_sending_to_public_admin(self): - """ A public administration has no VAT, but has an arbitrary number (see: - https://pch.gouvernement.lu/fr/peppol.html). When a partner has no VAT, the node PartyTaxScheme should - not appear. - NB: The `EndpointID` node should be filled with this arbitrary number, that is why `l10n_lu_peppol_id` - module was created. However we cannot use it here because it would require adding it to the dependencies of - `l10n_account_edi_ubl_cii_tests` in stable. - """ - self.partner_2.vat = None invoice = self._generate_move( - self.partner_1, - self.partner_2, + seller=self.partner_1, + buyer=self.partner_2, move_type='out_invoice', - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 2, - 'price_unit': 100, - 'tax_ids': [(6, 0, self.tax_21.ids)], - } - ], + invoice_line_ids=[{'product_id': self.product_a.id}], ) - self._assert_invoice_attachment( - invoice, - xpaths=''' - - ___ignore___ - - - ___ignore___ - - - ___ignore___ - - ''', - expected_file='from_odoo/bis3_out_invoice_public_admin.xml', - ) - - def test_rounding_price_unit(self): - """ OpenPeppol states that: - * All document level amounts shall be rounded to two decimals for accounting - * Invoice line net amount shall be rounded to two decimals - See: https://docs.peppol.eu/poacc/billing/3.0/bis/#_rounding - Do not round the unit prices. It allows to obtain the correct line amounts when prices have more than 2 - digits. - """ - # Set the allowed number of digits for the price_unit - decimal_precision = self.env['decimal.precision'].search([('name', '=', 'Product Price')], limit=1) - self.assertTrue(bool(decimal_precision), "The decimal precision for Product Price is required for this test") - decimal_precision.digits = 4 - - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 10000, - 'price_unit': 0.4567, - 'tax_ids': [(6, 0, self.tax_21.ids)], - } - ], - ) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_out_invoice_rounding.xml') - - def test_export_with_fixed_taxes_case1(self): - # CASE 1: simple invoice with a recupel tax - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': 99, - 'tax_ids': [(6, 0, [self.recupel.id, self.tax_21.id])], - } - ], - ) - self.assertEqual(invoice.amount_total, 121) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_ecotaxes_case1.xml') - - def test_export_with_fixed_taxes_case2(self): - # CASE 2: Same but with several ecotaxes - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': 98, - 'tax_ids': [(6, 0, [self.recupel.id, self.auvibel.id, self.tax_21.id])], - } - ], - ) - self.assertEqual(invoice.amount_total, 121) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_ecotaxes_case2.xml') - - def test_export_with_fixed_taxes_case3(self): - # CASE 3: same as Case 1 but taxes are Price Included - self.recupel.price_include = True - self.tax_21.price_include = True - - # Price TTC = 121 = (99 + 1 ) * 1.21 - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': 121, - 'tax_ids': [(6, 0, [self.recupel.id, self.tax_21.id])], - } - ], - ) - self.assertEqual(invoice.amount_total, 121) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_ecotaxes_case3.xml') - - def test_export_with_fixed_taxes_case4(self): - """ CASE 4: simple invoice with a recupel tax + discount - 1) Subtotal (price after discount, without taxes): 99 * 2 * (1-0.9) = 178.2 - 2) Taxes: - - recupel = 2 - - VAT = (178.2 + 2) * 0.21 = 37.842 - 3) Total = 178.2 + 2 + 37.842 = 218.042 - """ - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 2, - 'discount': 10, - 'price_unit': 99, - 'tax_ids': [(6, 0, [self.recupel.id, self.tax_21.id])], - } - ], - ) - self.assertEqual(invoice.amount_total, 218.042) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_ecotaxes_case4.xml') - - def test_export_payment_terms(self): - """ - Tests the early payment discount using the example case from the VBO/FEB. - - ------------- + Price + Tax + Cash Discount (2%) + Taxable Amount + VAT -- - Product A | 200 | 6% | -4 | 196 | 11.76 - Product B | 2400 | 21% | -48 | 2352 | 493.92 - --------------+-------+-----+--------------------+----------------+------- - - Subtotal (Taxable amount incl. payment discount): 2548 - VAT: 505.68 - Payable amount (excl. payment discount): 3105.68 - Payable amount (incl. payment discount): 3053.68 - """ - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_payment_term_id=self.pay_term.id, - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': 200, - 'tax_ids': [(6, 0, [self.tax_6.id])], - }, - { - 'product_id': self.product_b.id, - 'quantity': 1, - 'price_unit': 2400, - 'tax_ids': [(6, 0, [self.tax_21.id])], - } - ], - ) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_pay_term.xml') - - def test_export_payment_terms_fixed_tax(self): - """ - Tests the early payment discount combined with a fixed tax. - - ------------- + Price + Tax + Cash Discount (2%) + ------- Taxable Amount + VAT ---- - Product A | 99 | 21% | -1.98 | 97.02 + 1 (fixed tax) | 20.5842 - --------------+-------+-----+--------------------+------------------------+--------- - NB: The fixed taxes (recupel, auvibel, etc) are excluded from the early payment discount ! - - Subtotal (Taxable amount incl. payment discount): 97.02 + 1 - VAT: (97.02 + 1) * 0.21 = 20.58 - Payable amount (excl. payment discount): 99 + 1 + 20.58 = 120.58 - Payable amount (incl. payment discount): 97.02 + 1 + 20.58 = 118.60 - """ - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_payment_term_id=self.pay_term.id, - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': 99, - 'tax_ids': [(6, 0, [self.tax_21.id, self.recupel.id])], - }, - ], - ) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_pay_term_ecotax.xml') - - def test_export_with_changed_taxes(self): - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': 200, - 'tax_ids': [Command.set([self.tax_21.id])], - }, - { - 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': 200, - 'tax_ids': [Command.set([self.tax_21.id])], - }, - { - 'product_id': self.product_b.id, - 'quantity': 1, - 'price_unit': 100, - 'tax_ids': [Command.set([self.tax_12.id])], - }, - { - 'product_id': self.product_b.id, - 'quantity': 1, - 'price_unit': 100, - 'tax_ids': [Command.set([self.tax_12.id])], - }, - ], - ) - self.assertRecordValues(invoice, [{ - 'amount_untaxed': 600.00, - 'amount_tax': 108.00, # tax_12: 24.00 ; tax_21: 84.00 - 'amount_total': 708.00 - }]) - - invoice.button_draft() - tax_lines = invoice.line_ids.filtered(lambda line: line.display_type == 'tax') - tax_line_21 = next((line for line in tax_lines if line.name == 'tax_21')) - tax_line_12 = next((line for line in tax_lines if line.name == 'tax_12')) - invoice.line_ids = [ - Command.update(tax_line_21.id, {'amount_currency': -84.03}), # distribute 3 cents over 2 lines - Command.update(tax_line_12.id, {'amount_currency': -23.99}), # distribute -1 cent over 2 lines - ] - invoice.action_post() - - self.assertRecordValues(invoice, [{ - 'amount_untaxed': 600.00, - 'amount_tax': 108.02, # tax_12: 23.99 ; tax_21: 84.03 - 'amount_total': 708.02 - }]) - - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_export_with_changed_taxes.xml') - - def test_export_rounding_price_amount(self): - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_line_ids=[ - {'quantity': 3, 'price_unit': 102.15}, - {'quantity': 3, 'price_unit': 83.60}, - ], - ) - attachment = invoice._get_edi_attachment(self.edi_format) - price_amounts = etree.fromstring(attachment.raw).findall('.//{*}InvoiceLine/{*}Price/{*}PriceAmount') - self.assertEqual(price_amounts[0].text, '102.15') - self.assertEqual(price_amounts[1].text, '83.6') - - def test_export_tax_exempt(self): - invoice = self._generate_move( - self.partner_1, - self.partner_2, - move_type='out_invoice', - invoice_line_ids=[ - { - 'product_id': self.product_a.id, - 'price_unit': 990.0, - 'tax_ids': [(6, 0, self.tax_0.ids)], - }, - ], - ) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_out_invoice_tax_exempt.xml') + self._test_encoding_in_attachment(invoice.ubl_cii_xml_id, 'ubl_bis3.xml') #################################################### # Test import #################################################### def test_import_partner_ubl(self): - """ - Given an invoice where partner_1 is the vendor and partner_2 is the customer with an EDI attachment. - * Uploading the attachment as an invoice should create an invoice with the buyer = partner_2. - * Uploading the attachment as a vendor bill should create a bill with the vendor = partner_1. - """ invoice = self._generate_move( seller=self.partner_1, buyer=self.partner_2, move_type='out_invoice', invoice_line_ids=[{'product_id': self.product_a.id}], ) - new_invoice = self._import_invoice_attachment(invoice, 'ubl_bis3', self.company_data['default_journal_sale']) - self.assertEqual(self.partner_2, new_invoice.partner_id) + self._test_import_partner(invoice.ubl_cii_xml_id, self.partner_1, self.partner_2) - new_invoice = self._import_invoice_attachment(invoice, 'ubl_bis3', self.company_data['default_journal_purchase']) - self.assertEqual(self.partner_1, new_invoice.partner_id) - - def test_import_journal_ubl(self): - """ - If the context contains the info about the current default journal, we should use it - instead of infering the journal from the move type. - """ - journal2 = self.company_data['default_journal_sale'].copy() - journal2.default_account_id = self.company_data['default_account_revenue'].id + def test_import_in_journal_ubl(self): invoice = self._generate_move( seller=self.partner_1, buyer=self.partner_2, move_type='out_invoice', invoice_line_ids=[{'product_id': self.product_a.id}], ) - edi_attachment = invoice._get_edi_attachment(self.env.ref('account_edi_ubl_cii.ubl_bis3')).id - - new_invoice = self.env['account.journal'].with_context(default_move_type='out_invoice')._create_document_from_attachment(edi_attachment) - self.assertEqual(new_invoice.journal_id, self.company_data['default_journal_sale']) - - new_invoice = self.env['account.journal'].with_context(default_journal_id=journal2.id)._create_document_from_attachment(edi_attachment) - self.assertEqual(new_invoice.journal_id, journal2) + self._test_import_in_journal(invoice.ubl_cii_xml_id) def test_import_and_create_partner_ubl(self): """ Tests whether the partner is created at import if no match is found when decoding the EDI attachment """ partner_vals = { 'name': "Buyer", - 'mail': "buyer@yahoo.com", + 'email': "buyer@yahoo.com", 'phone': "1111", 'vat': "BE980737405", } # assert there is no matching partner - partner_match = self.env['account.edi.format']._retrieve_partner(**partner_vals) + partner_match = self.env['res.partner']._retrieve_partner(**partner_vals) self.assertFalse(partner_match) # Import attachment as an invoice @@ -608,14 +277,13 @@ class TestUBLBE(TestUBLCommon): 'move_type': 'out_invoice', 'journal_id': self.company_data['default_journal_sale'].id, }) - self.update_invoice_from_file( + self._update_invoice_from_file( module_name='l10n_account_edi_ubl_cii_tests', subfolder='tests/test_files/from_odoo', filename='ubl_test_import_partner.xml', invoice=invoice) # assert a new partner has been created - partner_vals['email'] = partner_vals.pop('mail') self.assertRecordValues(invoice.partner_id, [partner_vals]) def test_import_export_invoice_xml(self): @@ -623,9 +291,33 @@ class TestUBLBE(TestUBLCommon): Test whether the elements only specific to ubl_be are correctly exported and imported in the xml file """ - self.invoice.action_post() - attachment = self.invoice._get_edi_attachment(self.edi_format) + acc_bank = self.env['res.partner.bank'].create({ + 'acc_number': 'BE15001559627231', + 'partner_id': self.company_data['company'].partner_id.id, + 'allow_out_payment': True, + }) + + invoice = self._generate_move( + self.partner_1, + self.partner_2, + move_type='out_invoice', + partner_id=self.partner_1.id, + partner_bank_id=acc_bank.id, + invoice_date='2017-01-01', + date='2017-01-01', + invoice_line_ids=[{ + 'product_id': self.product_a.id, + 'product_uom_id': self.env.ref('uom.product_uom_dozen').id, + 'price_unit': 275.0, + 'quantity': 5, + 'discount': 20.0, + 'tax_ids': [(6, 0, self.tax_21.ids)], + }], + ) + + attachment = invoice.ubl_cii_xml_id self.assertTrue(attachment) + xml_content = base64.b64decode(attachment.with_context(bin_size=False).datas) xml_etree = self.get_xml_tree_from_string(xml_content) @@ -643,38 +335,88 @@ class TestUBLBE(TestUBLCommon): # Import: created_bill = self.env['account.move'].create({'move_type': 'in_invoice'}) + self.env['res.partner'].search([('vat', '=', 'BE0246697724'), ('id', '!=', self.company_data['company'].id)]).vat = False # clean demo company to avoid picking it as a partner created_bill.message_post(attachment_ids=[attachment.id]) self.assertTrue(created_bill) def test_import_invoice_xml(self): kwargs = { 'subfolder': 'tests/test_files/from_odoo', - 'amount_total': 3164.22, - 'amount_tax': 482.22, - 'list_line_subtotals': [1782, 1000, -100], - 'list_line_price_unit': [990, 100, 100], - 'list_line_discount': [10, 0, 0], - 'currency_id': self.currency_data['currency'].id, + 'invoice_vals': { + 'currency_id': self.other_currency.id, + 'amount_total': 3164.22, + 'amount_tax': 482.22, + 'invoice_lines': [{ + 'price_subtotal': subtotal, + 'price_unit': price_unit, + 'discount': discount, + } for (subtotal, price_unit, discount) in [(1782, 990, 10), (1000, 100, 0), (-100, 100, 0)]] + }, } self._assert_imported_invoice_from_file(filename='bis3_out_invoice.xml', **kwargs) # same as the file above, but the are missing in the invoice lines self._assert_imported_invoice_from_file(filename='bis3_out_invoice_no_prices.xml', **kwargs) def test_import_invoice_xml_open_peppol_examples(self): + self.env['res.partner.bank'].sudo().create({ + 'acc_number': 'IBAN32423940', + 'partner_id': self.company_data['company'].partner_id.id, + }) # Source: https://github.com/OpenPEPPOL/peppol-bis-invoice-3/tree/master/rules/examples subfolder = 'tests/test_files/from_peppol-bis-invoice-3_doc' # source: Allowance-example.xml - self._assert_imported_invoice_from_file(subfolder=subfolder, filename='bis3_allowance.xml', amount_total=7125, - amount_tax=1225, list_line_subtotals=[200, -200, 4000, 1000, 900]) + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_allowance.xml', + invoice_vals={ + 'amount_total': 7125, + 'amount_tax': 1225, + 'invoice_lines': [{'price_subtotal': x} for x in (200, -200, 3999, 1, 1000, 899, 1)], + }, + ) # source: base-creditnote-correction.xml - self._assert_imported_invoice_from_file(subfolder=subfolder, filename='bis3_credit_note.xml', - amount_total=1656.25, amount_tax=331.25, list_line_subtotals=[25, 2800, -1500], move_type='in_refund') + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_credit_note.xml', + move_type='in_refund', + invoice_vals={ + 'amount_total': 1656.25, + 'amount_tax': 331.25, + 'invoice_lines': [{'price_subtotal': x} for x in (25, 2800, -1500)], + }, + ) # source: base-negative-inv-correction.xml - self._assert_imported_invoice_from_file(subfolder=subfolder, filename='bis3_invoice_negative_amounts.xml', - amount_total=1656.25, amount_tax=331.25, list_line_subtotals=[25, 2800, -1500], move_type='in_refund') + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_invoice_negative_amounts.xml', + move_type='in_refund', + invoice_vals={ + 'amount_total': 1656.25, + 'amount_tax': 331.25, + 'invoice_lines': [{'price_subtotal': x} for x in (25, 2800, -1500)], + }, + ) + # source: base-creditnote-correction.xml with ignored LineExtensionAmount + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_invoice_ignore_lineextensionamount.xml', + invoice_vals={ + 'amount_total': 1000, + 'amount_tax': 0, + 'invoice_lines': [{'price_subtotal': 1000}], + } + ) # source: vat-category-E.xml - self._assert_imported_invoice_from_file(subfolder=subfolder, filename='bis3_tax_exempt_gbp.xml', - amount_total=1200, amount_tax=0, list_line_subtotals=[1200], currency_id=self.env.ref('base.GBP').id) + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_tax_exempt_gbp.xml', + invoice_vals={ + 'currency_id': self.env.ref('base.GBP').id, + 'amount_total': 1200, + 'amount_tax': 0, + 'invoice_lines': [{'price_subtotal': 1200}], + }, + ) def test_import_existing_invoice_flip_move_type(self): """ Tests whether the move_type of an existing invoice can be flipped when importing an attachment @@ -683,7 +425,7 @@ class TestUBLBE(TestUBLCommon): the move type needs to be changed to 'out_refund' """ invoice = self.env['account.move'].create({'move_type': 'out_invoice'}) - self.update_invoice_from_file( + self._update_invoice_from_file( 'l10n_account_edi_ubl_cii_tests', 'tests/test_files/from_odoo', 'bis3_out_refund.xml', @@ -698,60 +440,201 @@ class TestUBLBE(TestUBLCommon): """ subfolder = "tests/test_files/from_odoo" # The tax 21% from l10n_be is retrieved since it's a duplicate of self.tax_21 - tax_21 = self.env.ref(f'l10n_be.{self.env.company.id}_attn_VAT-OUT-21-L') + tax_21 = self.env.ref(f'account.{self.env.company.id}_attn_VAT-OUT-21-L') self._assert_imported_invoice_from_file( - subfolder=subfolder, filename='bis3_ecotaxes_case1.xml', amount_total=121, amount_tax=22, - list_line_subtotals=[99], currency_id=self.currency_data['currency'].id, list_line_price_unit=[99], - list_line_discount=[0], list_line_taxes=[tax_21+self.recupel], move_type='out_invoice', - ) - self._assert_imported_invoice_from_file( - subfolder=subfolder, filename='bis3_ecotaxes_case2.xml', amount_total=121, amount_tax=23, - list_line_subtotals=[98], currency_id=self.currency_data['currency'].id, list_line_price_unit=[98], - list_line_discount=[0], list_line_taxes=[tax_21+self.recupel+self.auvibel], move_type='out_invoice', - ) - self._assert_imported_invoice_from_file( - subfolder=subfolder, filename='bis3_ecotaxes_case3.xml', amount_total=121, amount_tax=22, - list_line_subtotals=[99], currency_id=self.currency_data['currency'].id, list_line_price_unit=[99], - list_line_discount=[0], list_line_taxes=[tax_21+self.recupel], move_type='out_invoice', - ) - self._assert_imported_invoice_from_file( - subfolder=subfolder, filename='bis3_ecotaxes_case4.xml', amount_total=218.04, amount_tax=39.84, - list_line_subtotals=[178.20000000000002], currency_id=self.currency_data['currency'].id, - list_line_price_unit=[99], list_line_discount=[10], list_line_taxes=[tax_21+self.recupel], + subfolder=subfolder, + filename='bis3_ecotaxes_case1.xml', move_type='out_invoice', + invoice_vals={ + 'currency_id': self.other_currency.id, + 'amount_total': 121, + 'amount_tax': 22, + 'invoice_lines': [{ + 'price_unit': 99, + 'discount': 0, + 'price_subtotal': 99, + 'tax_ids': (tax_21 + self.recupel).ids, + }] + } + ) + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_ecotaxes_case2.xml', + move_type='out_invoice', + invoice_vals={ + 'currency_id': self.other_currency.id, + 'amount_total': 121, + 'amount_tax': 23, + 'invoice_lines': [{ + 'price_unit': 98, + 'discount': 0, + 'price_subtotal': 98, + 'tax_ids': (tax_21 + self.recupel + self.auvibel).ids, + }] + }, + ) + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_ecotaxes_case3.xml', + move_type='out_invoice', + invoice_vals={ + 'currency_id': self.other_currency.id, + 'amount_total': 121, + 'amount_tax': 22, + 'invoice_lines': [{ + 'price_unit': 99, + 'discount': 0, + 'price_subtotal': 99, + 'tax_ids': (tax_21 + self.recupel).ids, + }] + }, + ) + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_ecotaxes_case4.xml', + move_type='out_invoice', + invoice_vals={ + 'currency_id': self.other_currency.id, + 'amount_total': 218.04, + 'amount_tax': 39.84, + 'invoice_lines': [{ + 'price_unit': 99, + 'quantity': 2, + 'discount': 10, + 'price_subtotal': 178.2, + 'tax_ids': (tax_21 + self.recupel).ids, + }] + }, ) def test_import_payment_terms(self): # The tax 21% from l10n_be is retrieved since it's a duplicate of self.tax_21 - tax_21 = self.env.ref(f'l10n_be.{self.env.company.id}_attn_VAT-OUT-21-L') + tax_21 = self.env.ref(f'account.{self.env.company.id}_attn_VAT-OUT-21-L') self._assert_imported_invoice_from_file( - subfolder='tests/test_files/from_odoo', filename='bis3_pay_term.xml', amount_total=3105.68, - amount_tax=505.68, list_line_subtotals=[-4, -48, 52, 200, 2400], - currency_id=self.currency_data['currency'].id, list_line_price_unit=[-4, -48, 52, 200, 2400], - list_line_discount=[0, 0, 0, 0, 0], list_line_taxes=[self.tax_6, tax_21, self.tax_0, self.tax_6, tax_21], + subfolder='tests/test_files/from_odoo', + filename='bis3_pay_term.xml', move_type='out_invoice', + invoice_vals={ + 'currency_id': self.other_currency.id, + 'amount_total': 3105.68, + 'amount_tax': 505.68, + 'invoice_lines': [ + { + 'price_unit': price_unit, + 'price_subtotal': price_unit, + 'discount': 0, + 'tax_ids': tax.ids, + } for (price_unit, tax) in [ + (-4, self.tax_6), + (-48, tax_21), + (52, self.tax_0), + (200, self.tax_6), + (2400, tax_21), + ] + ] + }, ) - def test_inverting_negative_price_unit(self): - """ We can not have negative unit prices, so we try to invert the unit price and quantity. - """ + #################################################### + # Test Send & print + #################################################### + + def test_send_and_print(self): invoice = self._generate_move( self.partner_1, self.partner_2, + send=False, move_type='out_invoice', invoice_line_ids=[ { 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': 100.0, - 'tax_ids': [(6, 0, self.tax_21.ids)], + 'tax_ids': [Command.set(self.tax_21.ids)], }, - { - 'product_id': self.product_a.id, - 'quantity': 1, - 'price_unit': -25.0, - 'tax_ids': [(6, 0, self.tax_21.ids)], - } ], ) - self._assert_invoice_attachment(invoice, None, 'from_odoo/bis3_out_invoice_negative_unit_price.xml') + self.assertEqual(self.partner_2.invoice_edi_format, 'ubl_bis3') + wizard = self.create_send_and_print(invoice, sending_methods=['manual']) + self.assertRecordValues(wizard, [{ + 'sending_methods': ['manual'], + 'invoice_edi_format': 'ubl_bis3', + 'extra_edi_checkboxes': False, + }]) + self._assert_mail_attachments_widget(wizard, [ + { + 'mimetype': 'application/pdf', + 'name': 'INV_2017_00001.pdf', + 'placeholder': True, + }, + { + 'mimetype': 'application/xml', + 'name': 'INV_2017_00001_ubl_bis3.xml', + 'placeholder': True, + }, + ]) + self.assertFalse(invoice.invoice_pdf_report_id) + self.assertFalse(invoice.ubl_cii_xml_id) + + # Send. + wizard.action_send_and_print() + self.assertTrue(invoice.invoice_pdf_report_id) + self.assertTrue(invoice.ubl_cii_xml_id) + invoice_attachments = self.env['ir.attachment'].search([ + ('res_model', '=', invoice._name), + ('res_id', '=', invoice.id), + ('res_field', 'in', ('invoice_pdf_report_file', 'ubl_cii_xml_file')), + ]) + self.assertEqual(len(invoice_attachments), 2) + + # Send again. + wizard = self.create_send_and_print(invoice, sending_methods=['manual']) + self.assertRecordValues(wizard, [{ + 'sending_methods': ['manual'], + 'invoice_edi_format': 'ubl_bis3', + }]) + self._assert_mail_attachments_widget(wizard, [ + { + 'id': invoice.invoice_pdf_report_id.id, + 'mimetype': 'application/pdf', + 'name': 'INV_2019_00001.pdf', + }, + { + 'id': invoice.ubl_cii_xml_id.id, + 'mimetype': 'application/xml', + 'name': 'INV_2019_00001_ubl_bis3.xml', + }, + ]) + wizard.action_send_and_print() + self.assertTrue(invoice.invoice_pdf_report_id) + self.assertTrue(invoice.ubl_cii_xml_id) + invoice_attachments = self.env['ir.attachment'].search([ + ('res_model', '=', invoice._name), + ('res_id', '=', invoice.id), + ('res_field', 'in', ('invoice_pdf_report_file', 'ubl_cii_xml_file')), + ]) + self.assertEqual(len(invoice_attachments), 2) + + def test_import_quantity_and_or_unit_price_zero(self): + """ Tests some special handling cases in which the quantity or unit_price are missing. + """ + subfolder = "tests/test_files/from_odoo" + # The tax 21% from l10n_be is retrieved since it's a duplicate of self.tax_21 + tax_21 = self.env.ref(f'account.{self.env.company.id}_attn_VAT-OUT-21-L') + self._assert_imported_invoice_from_file( + subfolder=subfolder, + filename='bis3_out_invoice_quantity_and_or_unit_price_zero.xml', + move_type='out_invoice', + invoice_vals={ + 'amount_total': 3630, + 'amount_tax': 630, + 'currency_id': self.other_currency.id, + 'invoice_lines': [ + { + 'price_unit': price_unit, + 'quantity': quantity, + 'discount': 0, + 'tax_ids': tax_21.ids, + 'price_subtotal': 1000, + } for price_unit, quantity in [(1000, 1), (100, 10), (10, 100)] + ] + } + ) diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_de.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_de.py index 0bd3ca7..d88fd68 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_de.py +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_de.py @@ -2,6 +2,7 @@ from odoo import Command from odoo.addons.l10n_account_edi_ubl_cii_tests.tests.common import TestUBLCommon from odoo.tests import tagged +from odoo.exceptions import UserError import base64 @@ -9,11 +10,9 @@ import base64 class TestUBLDE(TestUBLCommon): @classmethod - def setUpClass(cls, - chart_template_ref="l10n_de_skr03.l10n_de_chart_template", - edi_format_ref="account_edi_ubl_cii.ubl_de", - ): - super().setUpClass(chart_template_ref=chart_template_ref, edi_format_ref=edi_format_ref) + @TestUBLCommon.setup_country("de") + def setUpClass(cls): + super().setUpClass() cls.partner_1 = cls.env['res.partner'].create({ 'name': "partner_1", @@ -24,8 +23,9 @@ class TestUBLDE(TestUBLCommon): 'phone': '+49 180 6 225789', 'email': 'info@legoland.de', 'country_id': cls.env.ref('base.de').id, - 'bank_ids': [(0, 0, {'acc_number': 'DE48500105176424548921'})], + 'bank_ids': [(0, 0, {'acc_number': 'DE48500105176424548921', 'allow_out_payment': True})], 'ref': 'ref_partner_1', + 'invoice_edi_format': 'xrechnung', }) cls.partner_2 = cls.env['res.partner'].create({ @@ -35,8 +35,9 @@ class TestUBLDE(TestUBLCommon): 'city': "Rust", 'vat': 'DE186775212', 'country_id': cls.env.ref('base.de').id, - 'bank_ids': [(0, 0, {'acc_number': 'DE50500105175653254743'})], + 'bank_ids': [(0, 0, {'acc_number': 'DE50500105175653254743', 'allow_out_payment': True})], 'ref': 'ref_partner_2', + 'invoice_edi_format': 'zugferd', }) cls.tax_19 = cls.env['account.tax'].create({ @@ -56,17 +57,22 @@ class TestUBLDE(TestUBLCommon): }) @classmethod - def setup_company_data(cls, company_name, chart_template): - # OVERRIDE - # to force the company to be german + add phone and email - res = super().setup_company_data( - company_name, - chart_template=chart_template, - country_id=cls.env.ref("base.de").id, + def setup_independent_company(cls, **kwargs): + return super().setup_independent_company( phone="+49(0) 30 227-0", email="test@xrechnung@com", + **kwargs, ) - return res + + def _detach_attachment(self, attachment): + # attachments are protected from being edited because of the audit trail + # in the tests, we are reusing the ame attachment coming from another invoice, which would then switch invoice + self.env.cr.execute("UPDATE ir_attachment SET res_id = NULL WHERE id = %s", (attachment.id,)) + attachment.invalidate_recordset() + + def _assert_imported_invoice_from_etree(self, invoice, attachment): + self._detach_attachment(attachment) + return super()._assert_imported_invoice_from_etree(invoice, attachment) #################################################### # Test export - import @@ -103,32 +109,82 @@ class TestUBLDE(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - invoice, - xpaths=''' - - ___ignore___ - - - ___ignore___ - - - ___ignore___ - - - ___ignore___ - - - ___ignore___ - - ''', - expected_file='from_odoo/xrechnung_ubl_out_invoice.xml', + invoice.ubl_cii_xml_id, + xpaths=None, + expected_file_path='from_odoo/zugferd_out_invoice.xml', ) - self.assertEqual(attachment.name[-10:], "ubl_de.xml") + self.assertEqual(attachment.name[-11:], "zugferd.xml") self._assert_imported_invoice_from_etree(invoice, attachment) - def test_export_import_invoice_without_vat(self): - self.partner_2.vat = False - self.partner_2.email = 'partner_2@test.test' + def test_export_import_invoice_xrechnung(self): + self.partner_2.write({ + 'peppol_eas': '0204', + 'peppol_endpoint': '123456789', + 'invoice_edi_format': 'xrechnung' + }) + invoice = self._generate_move( + self.partner_1, + self.partner_2, + move_type='out_invoice', + invoice_line_ids=[ + { + 'product_id': self.product_a.id, + 'quantity': 2.0, + 'product_uom_id': self.env.ref('uom.product_uom_dozen').id, + 'price_unit': 990.0, + 'discount': 10.0, + 'tax_ids': [(6, 0, self.tax_19.ids)], + }, + { + 'product_id': self.product_b.id, + 'quantity': 10.0, + 'product_uom_id': self.env.ref('uom.product_uom_unit').id, + 'price_unit': 100.0, + 'tax_ids': [(6, 0, self.tax_7.ids)], + }, + { + 'product_id': self.product_b.id, + 'quantity': -1.0, + 'product_uom_id': self.env.ref('uom.product_uom_unit').id, + 'price_unit': 100.0, + 'tax_ids': [(6, 0, self.tax_7.ids)], + }, + ], + ) + attachment = self._assert_invoice_attachment( + invoice.ubl_cii_xml_id, + xpaths=f''' + + ___ignore___ + + + ___ignore___ + + + ___ignore___ + + + ___ignore___ + + + ___ignore___ + + + application/pdf + {invoice.invoice_pdf_report_id.name} + + ''', + expected_file_path='from_odoo/xrechnung_ubl_out_invoice.xml', + ) + self.assertEqual(attachment.name[-13:], "xrechnung.xml") + self._assert_imported_invoice_from_etree(invoice, attachment) + + def test_export_import_invoice_without_vat_and_peppol_endpoint(self): + self.partner_2.write({ + 'vat': False, + 'peppol_endpoint': False, + 'email': 'partner_2@test.test', + }) invoice = self._generate_move( self.partner_1, self.partner_2, @@ -143,21 +199,10 @@ class TestUBLDE(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - invoice, - xpaths=''' - - ___ignore___ - - - ___ignore___ - - - ___ignore___ - - ''', - expected_file='from_odoo/xrechnung_ubl_out_invoice_without_vat.xml', + invoice.ubl_cii_xml_id, + xpaths=None, + expected_file_path='from_odoo/zugferd_out_invoice_without_vat.xml', ) - self.assertEqual(attachment.name[-10:], "ubl_de.xml") self._assert_imported_invoice_from_etree(invoice, attachment) def test_export_import_refund(self): @@ -191,27 +236,75 @@ class TestUBLDE(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - refund, - xpaths=''' + refund.ubl_cii_xml_id, + xpaths=None, + expected_file_path='from_odoo/zugferd_out_refund.xml', + ) + self.assertEqual(attachment.name[-11:], "zugferd.xml") + self._assert_imported_invoice_from_etree(refund, attachment) + + def test_export_import_refund_xrehnung(self): + self.partner_2.write({ + 'peppol_eas': '0204', + 'peppol_endpoint': '123456789', + 'invoice_edi_format': 'xrechnung' + }) + + refund = self._generate_move( + self.partner_1, + self.partner_2, + move_type='out_refund', + invoice_line_ids=[ + { + 'product_id': self.product_a.id, + 'quantity': 2.0, + 'product_uom_id': self.env.ref('uom.product_uom_dozen').id, + 'price_unit': 990.0, + 'discount': 10.0, + 'tax_ids': [(6, 0, self.tax_19.ids)], + }, + { + 'product_id': self.product_b.id, + 'quantity': 10.0, + 'product_uom_id': self.env.ref('uom.product_uom_unit').id, + 'price_unit': 100.0, + 'tax_ids': [(6, 0, self.tax_7.ids)], + }, + { + 'product_id': self.product_b.id, + 'quantity': -1.0, + 'product_uom_id': self.env.ref('uom.product_uom_unit').id, + 'price_unit': 100.0, + 'tax_ids': [(6, 0, self.tax_7.ids)], + }, + ], + ) + attachment = self._assert_invoice_attachment( + refund.ubl_cii_xml_id, + xpaths=f''' - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ + + + application/pdf + {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.assertEqual(attachment.name[-13:], "xrechnung.xml") self._assert_imported_invoice_from_etree(refund, attachment) #################################################### @@ -219,9 +312,16 @@ class TestUBLDE(TestUBLCommon): #################################################### def test_import_invoice_xml(self): - self._assert_imported_invoice_from_file(subfolder='tests/test_files/from_odoo', - filename='xrechnung_ubl_out_invoice.xml', amount_total=3083.58, amount_tax=401.58, - list_line_subtotals=[1782, 1000, -100], currency_id=self.currency_data['currency'].id) + self._assert_imported_invoice_from_file( + subfolder='tests/test_files/from_odoo', + filename='xrechnung_ubl_out_invoice.xml', + invoice_vals={ + 'currency_id': self.other_currency.id, + 'amount_total': 3083.58, + 'amount_tax': 401.58, + 'invoice_lines': [{'price_subtotal': x} for x in (1782, 1000, -100)], + }, + ) def test_import_export_invoice_xml(self): """ @@ -231,29 +331,32 @@ class TestUBLDE(TestUBLCommon): acc_bank = self.env['res.partner.bank'].create({ 'acc_number': 'BE15001559627232', 'partner_id': self.company_data['company'].partner_id.id, + 'allow_out_payment': True, }) - invoice = self.env['account.move'].create({ - 'move_type': 'out_invoice', - 'journal_id': self.journal.id, - 'partner_id': self.partner_1.id, - 'partner_bank_id': acc_bank.id, - 'invoice_date': '2017-01-01', - 'date': '2017-01-01', - 'currency_id': self.currency_data['currency'].id, - 'invoice_line_ids': [(0, 0, { + + invoice = self._generate_move( + self.partner_1, + self.partner_2, + move_type='out_invoice', + partner_id=self.partner_1.id, + partner_bank_id=acc_bank.id, + invoice_date='2017-01-01', + date='2017-01-01', + invoice_line_ids=[{ 'product_id': self.product_a.id, 'product_uom_id': self.env.ref('uom.product_uom_dozen').id, 'price_unit': 275.0, 'quantity': 5, 'discount': 20.0, 'tax_ids': [(6, 0, self.tax_19.ids)], - })], - }) + }], + ) partner = invoice.commercial_partner_id - invoice.action_post() - attachment = invoice._get_edi_attachment(self.edi_format) + attachment = invoice.ubl_cii_xml_id + self.assertTrue(attachment) + xml_content = base64.b64decode(attachment.with_context(bin_size=False).datas) xml_etree = self.get_xml_tree_from_string(xml_content) @@ -265,5 +368,37 @@ class TestUBLDE(TestUBLCommon): ) created_bill = self.env['account.move'].create({'move_type': 'in_invoice'}) + self._detach_attachment(attachment) created_bill.message_post(attachment_ids=[attachment.id]) self.assertTrue(created_bill) + + def test_leitweg_id(self): + partner = self.partner_2 + partner.write({ + 'peppol_eas': '0204', + 'peppol_endpoint': '123456789', + 'invoice_edi_format': 'xrechnung', + }) + + acc_bank = self.env['res.partner.bank'].create({ + 'acc_number': 'DE15001559627232', + 'partner_id': partner.id, + 'allow_out_payment': True, + }) + + invoice = self._generate_move( + self.partner_1, + partner, + move_type='out_invoice', + partner_id=partner.id, + partner_bank_id=acc_bank.id, + invoice_date='2025-12-01', + invoice_line_ids=[{'product_id': self.product_a.id}], + ) + attachment = invoice.ubl_cii_xml_id + + self.assertTrue(attachment) + + xml_content = base64.b64decode(attachment.with_context(bin_size=False).datas) + xml_etree = self.get_xml_tree_from_string(xml_content) + self.assertEqual(xml_etree.find('{*}BuyerReference').text, '123456789') diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_nl.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_nl.py index 7abce1e..2f1bdda 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_nl.py +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_nl.py @@ -10,11 +10,9 @@ from lxml import etree class TestUBLNL(TestUBLCommon): @classmethod - def setUpClass(cls, - chart_template_ref="l10n_nl.l10nnl_chart_template", - edi_format_ref="account_edi_ubl_cii.edi_nlcius_1", - ): - super().setUpClass(chart_template_ref=chart_template_ref, edi_format_ref=edi_format_ref) + @TestUBLCommon.setup_country('nl') + def setUpClass(cls): + super().setUpClass() cls.partner_1 = cls.env['res.partner'].create({ 'name': "partner_1", @@ -25,9 +23,11 @@ class TestUBLNL(TestUBLCommon): 'phone': '+31 180 6 225789', 'email': 'info@outlook.nl', 'country_id': cls.env.ref('base.nl').id, - 'bank_ids': [(0, 0, {'acc_number': 'NL000099998B57'})], - 'l10n_nl_kvk': '77777677', + 'bank_ids': [(0, 0, {'acc_number': 'NL000099998B57', 'allow_out_payment': True})], + 'peppol_eas': '0106', + 'peppol_endpoint': '77777677', 'ref': 'ref_partner_1', + 'invoice_edi_format': 'nlcius', }) cls.partner_2 = cls.env['res.partner'].create({ @@ -37,9 +37,12 @@ class TestUBLNL(TestUBLCommon): 'city': "Rotterdam", 'vat': 'NL41452B11', 'country_id': cls.env.ref('base.nl').id, - 'bank_ids': [(0, 0, {'acc_number': 'NL93999574162167'})], - 'l10n_nl_kvk': '1234567', + 'bank_ids': [(0, 0, {'acc_number': 'NL93999574162167', 'allow_out_payment': True})], + 'peppol_eas': '9944', + 'peppol_endpoint': 'NL41452B11', + 'company_registry': '123456789', 'ref': 'ref_partner_2', + 'invoice_edi_format': 'nlcius', }) cls.tax_19 = cls.env['account.tax'].create({ @@ -84,17 +87,6 @@ class TestUBLNL(TestUBLCommon): 'sequence': 1, }) - @classmethod - def setup_company_data(cls, company_name, chart_template): - # OVERRIDE - # to force the company to be dutch - res = super().setup_company_data( - company_name, - chart_template=chart_template, - country_id=cls.env.ref("base.nl").id, - ) - return res - #################################################### # Test export - import #################################################### @@ -130,25 +122,29 @@ class TestUBLNL(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - invoice, - xpaths=''' + invoice.ubl_cii_xml_id, + xpaths=f''' - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ + + + application/pdf + {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) @@ -184,38 +180,38 @@ class TestUBLNL(TestUBLCommon): ], ) attachment = self._assert_invoice_attachment( - refund, - xpaths=''' + refund.ubl_cii_xml_id, + xpaths=f''' - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ - ___ignore___ + ___ignore___ + + + application/pdf + {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) - def test_export_fixed_tax_nlcius_and_peppol(self): + def test_export_fixed_tax(self): """ Ensure that an invoice containing a product with a fixed tax posted to a journal with the peppol and nlcius edi tags generates edi documents with accurate LineExtensionAmount values """ - self.journal.edi_format_ids = [ - Command.link(self.env.ref('account_edi_ubl_cii.ubl_bis3').id) - ] - invoice = self._generate_move( self.partner_1, self.partner_2, move_type='out_invoice', @@ -226,17 +222,8 @@ class TestUBLNL(TestUBLCommon): 'tax_ids': [Command.set([self.tax_10_fixed.id, self.tax_7_purchase.id])] }] ) - - amounts = [ - etree.fromstring(doc.attachment_id.raw).find( - './/{*}LegalMonetaryTotal/{*}LineExtensionAmount' - ).text - for doc in invoice.edi_document_ids.filtered(lambda d: d.edi_format_id.code in ( - 'ubl_bis3', 'nlcius_1' - )) - ] - - self.assertEqual(amounts, ['60.00', '60.00']) + amount = etree.fromstring(invoice.ubl_cii_xml_id.raw).find('.//{*}LegalMonetaryTotal/{*}LineExtensionAmount').text + self.assertEqual(amount, '60.00') #################################################### # Test import @@ -244,6 +231,13 @@ class TestUBLNL(TestUBLCommon): def test_import_invoice_xml(self): # test files https://github.com/peppolautoriteit-nl/validation ? - self._assert_imported_invoice_from_file(subfolder='tests/test_files/from_odoo', - filename='nlcius_out_invoice.xml', amount_total=3083.58, amount_tax=401.58, - list_line_subtotals=[1782, 1000, -100], currency_id=self.currency_data['currency'].id) + self._assert_imported_invoice_from_file( + subfolder='tests/test_files/from_odoo', + filename='nlcius_out_invoice.xml', + invoice_vals={ + 'currency_id': self.other_currency.id, + 'amount_total': 3083.58, + 'amount_tax': 401.58, + 'invoice_lines': [{'price_subtotal': x} for x in (1782, 1000, -100)] + }, + ) diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_sg.py b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_sg.py new file mode 100644 index 0000000..9a5f73d --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_sg.py @@ -0,0 +1,142 @@ +from odoo import Command +from odoo.tests import tagged +from odoo.addons.l10n_account_edi_ubl_cii_tests.tests.common import TestUBLCommon + + +@tagged('post_install_l10n', 'post_install', '-at_install') +class TestUBLSG(TestUBLCommon): + + @classmethod + def setUpClass(cls): + super().setUpClass() + + cls.partner_1 = cls.env['res.partner'].create({ + 'name': "partner_1", + 'street': 'Tyersall Avenue', + 'zip': '248048', + 'city': 'Central Singapore', + 'vat': '197401143C', + 'phone': '+65 9123 4567', + 'email': 'info@outlook.sg', + 'country_id': cls.env.ref('base.sg').id, + 'bank_ids': [(0, 0, {'acc_number': '000099998B57', 'allow_out_payment': True})], + 'ref': 'ref_partner_1', + 'invoice_edi_format': 'ubl_sg', + 'peppol_eas': '0195', + 'peppol_endpoint': '197401143C', + }) + + cls.partner_2 = cls.env['res.partner'].create({ + 'name': "partner_2", + 'street': 'that other street, 3', + 'zip': '248050', + 'city': 'East Singapore', + 'vat': 'S16FC0121D', + 'phone': '+65 9123 4589', + 'country_id': cls.env.ref('base.sg').id, + 'bank_ids': [(0, 0, {'acc_number': '93999574162167', 'allow_out_payment': True})], + 'ref': 'ref_partner_2', + 'invoice_edi_format': 'ubl_sg', + 'peppol_eas': '0195', + 'peppol_endpoint': 'S16FC0121D', + }) + + #################################################### + # Test export - import + #################################################### + + def test_export_import_invoice(self): + tax_10 = self.percent_tax(10) + tax_0 = self.percent_tax(0) + invoice = self._generate_move( + self.partner_1, + self.partner_2, + move_type='out_invoice', + invoice_line_ids=[ + { + 'product_id': self.product_a.id, + 'quantity': 2.0, + 'price_unit': 1000.0, + 'discount': 20.0, + 'tax_ids': [(Command.set(tax_10.ids))], + }, + { + 'product_id': self.product_b.id, + 'quantity': 2.0, + 'price_unit': 500.0, + 'tax_ids': [(Command.set(tax_0.ids))], + }, + ], + ) + attachment = self._assert_invoice_attachment( + invoice.ubl_cii_xml_id, + xpaths=f''' + + ___ignore___ + + + ___ignore___ + + + ___ignore___ + + + ___ignore___ + + + application/pdf + {invoice.invoice_pdf_report_id.name} + + ''', + expected_file_path='from_odoo/sg_out_invoice.xml', + ) + self.assertEqual(attachment.name[-6:], "sg.xml") + self._assert_imported_invoice_from_etree(invoice, attachment) + + def test_export_import_refund(self): + tax_10 = self.percent_tax(10) + tax_0 = self.percent_tax(0) + refund = self._generate_move( + self.partner_1, + self.partner_2, + move_type='out_refund', + invoice_line_ids=[ + { + 'product_id': self.product_a.id, + 'quantity': 2.0, + 'price_unit': 1000.0, + 'discount': 20.0, + 'tax_ids': [(Command.set(tax_10.ids))], + }, + { + 'product_id': self.product_b.id, + 'quantity': 2.0, + 'price_unit': 500.0, + 'tax_ids': [(Command.set(tax_0.ids))], + }, + ], + ) + attachment = self._assert_invoice_attachment( + refund.ubl_cii_xml_id, + xpaths=f''' + + ___ignore___ + + + ___ignore___ + + + ___ignore___ + + + ___ignore___ + + + application/pdf + {refund.invoice_pdf_report_id.name} + + ''', + expected_file_path='from_odoo/sg_out_refund.xml', + ) + self.assertEqual(attachment.name[-6:], "sg.xml") + self._assert_imported_invoice_from_etree(refund, attachment) diff --git a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/pyproject.toml b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/pyproject.toml index 8711dc0..3199210 100644 --- a/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/pyproject.toml +++ b/odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests/pyproject.toml @@ -1,18 +1,19 @@ [project] name = "odoo-bringout-oca-ocb-l10n_account_edi_ubl_cii_tests" version = "16.0.0" -description = "Testing the Import/Export invoices with UBL/CII - Odoo addon" +description = "Testing the Import/Export invoices with UBL/CII - + Odoo addon + " authors = [ { name = "Ernad Husremovic", email = "hernad@bring.out.ba" } ] dependencies = [ - "odoo-bringout-oca-ocb-l10n_generic_coa>=16.0.0", - "odoo-bringout-oca-ocb-account_edi_ubl_cii>=16.0.0", - "odoo-bringout-oca-ocb-l10n_fr>=16.0.0", - "odoo-bringout-oca-ocb-l10n_be>=16.0.0", - "odoo-bringout-oca-ocb-l10n_de>=16.0.0", - "odoo-bringout-oca-ocb-l10n_nl>=16.0.0", - "odoo-bringout-oca-ocb-l10n_au>=16.0.0", + "odoo-bringout-oca-ocb-account_edi_ubl_cii>=19.0.0", + "TODO_MAP-l10n_fr_account>=19.0.0", + "odoo-bringout-oca-ocb-l10n_be>=19.0.0", + "odoo-bringout-oca-ocb-l10n_de>=19.0.0", + "odoo-bringout-oca-ocb-l10n_nl>=19.0.0", + "odoo-bringout-oca-ocb-l10n_au>=19.0.0", "requests>=2.25.1" ] readme = "README.md" @@ -22,7 +23,7 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Topic :: Office/Business", ] diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/README.md b/odoo-bringout-oca-ocb-l10n_ar_website_sale/README.md index 3685dae..625d16c 100644 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/README.md +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/README.md @@ -1,6 +1,6 @@ # Argentinean eCommerce -Be able to see Identification Type and AFIP Responsibility in ecommerce checkout form. +Bridge Website Sale for Argentina ## Installation @@ -10,36 +10,15 @@ pip install odoo-bringout-oca-ocb-l10n_ar_website_sale ## Dependencies -This addon depends on: - website_sale - l10n_ar -## Manifest Information - -- **Name**: Argentinean eCommerce -- **Version**: 1.0 -- **Category**: Accounting/Localizations/Website -- **License**: LGPL-3 -- **Installable**: True - ## Source -Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `l10n_ar_website_sale`. +- Repository: https://github.com/OCA/OCB +- Branch: 19.0 +- Path: addons/l10n_ar_website_sale ## License -This package maintains the original LGPL-3 license from the upstream Odoo project. - -## Documentation - -- Overview: doc/OVERVIEW.md -- Architecture: doc/ARCHITECTURE.md -- Models: doc/MODELS.md -- Controllers: doc/CONTROLLERS.md -- Wizards: doc/WIZARDS.md -- Install: doc/INSTALL.md -- Usage: doc/USAGE.md -- Configuration: doc/CONFIGURATION.md -- Dependencies: doc/DEPENDENCIES.md -- Troubleshooting: doc/TROUBLESHOOTING.md -- FAQ: doc/FAQ.md +This package preserves the original LGPL-3 license. diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/__init__.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/__init__.py index f294b04..0650744 100644 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/__init__.py +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/__init__.py @@ -1,4 +1 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import controllers from . import models -from . import tests diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/__manifest__.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/__manifest__.py index bff8108..d9c051f 100644 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/__manifest__.py +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/__manifest__.py @@ -1,23 +1,26 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Argentinean eCommerce', 'version': '1.0', 'category': 'Accounting/Localizations/Website', - 'sequence': 14, - 'author': 'Odoo, ADHOC SA', - 'description': """Be able to see Identification Type and AFIP Responsibility in ecommerce checkout form.""", + 'countries': ['ar'], + 'icon': '/base/static/img/country_flags/ar.png', + 'description': """Bridge Website Sale for Argentina""", 'depends': [ 'website_sale', 'l10n_ar', ], 'data': [ - 'data/ir_model_fields.xml', + 'views/res_config_settings_views.xml', 'views/templates.xml', ], - 'demo': [ - 'demo/website_demo.xml', - ], + 'assets': { + 'web.assets_frontend': [ + 'l10n_ar_website_sale/static/src/interactions/**/*', + 'l10n_ar_website_sale/static/src/scss/*.scss', + ] + }, 'installable': True, 'auto_install': True, + 'author': 'Odoo S.A.', 'license': 'LGPL-3', } diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/controllers/main.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/controllers/main.py deleted file mode 100644 index c8d27ac..0000000 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/controllers/main.py +++ /dev/null @@ -1,59 +0,0 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import _ -from odoo.addons.website_sale.controllers.main import WebsiteSale -from odoo.http import request - - -class L10nARWebsiteSale(WebsiteSale): - - def _get_mandatory_fields_billing(self, country_id=False): - """Extend mandatory fields to add new identification and responsibility fields when company is argentina""" - res = super()._get_mandatory_fields_billing(country_id) - if request.website.sudo().company_id.country_id.code == "AR": - res += ["l10n_latam_identification_type_id", "l10n_ar_afip_responsibility_type_id", "vat"] - return res - - def _get_country_related_render_values(self, kw, render_values): - res = super()._get_country_related_render_values(kw, render_values) - if request.website.sudo().company_id.country_id.code == "AR": - res.update({'identification': kw.get('l10n_latam_identification_type_id'), - 'responsibility': kw.get('l10n_ar_afip_responsibility_type_id'), - 'responsibility_types': request.env['l10n_ar.afip.responsibility.type'].search([]), - 'identification_types': request.env['l10n_latam.identification.type'].search( - ['|', ('country_id', '=', False), ('country_id.code', '=', 'AR')])}) - return res - - def _get_vat_validation_fields(self, data): - res = super()._get_vat_validation_fields(data) - if request.website.sudo().company_id.country_id.code == "AR": - res.update({'l10n_latam_identification_type_id': int(data['l10n_latam_identification_type_id']) - if data.get('l10n_latam_identification_type_id') else False}) - res.update({'name': data['name'] if data.get('name') else False}) - return res - - def checkout_form_validate(self, mode, all_form_values, data): - """ We extend the method to add a new validation. If AFIP Resposibility is: - - * Final Consumer or Foreign Customer: then it can select any identification type. - * Any other (Monotributista, RI, etc): should select always "CUIT" identification type""" - error, error_message = super().checkout_form_validate(mode, all_form_values, data) - - # Identification type and AFIP Responsibility Combination - if request.website.sudo().company_id.country_id.code == "AR": - if mode[1] == 'billing': - if error and any(field in error for field in ['l10n_latam_identification_type_id', 'l10n_ar_afip_responsibility_type_id']): - return error, error_message - id_type_id = data.get("l10n_latam_identification_type_id") - afip_resp_id = data.get("l10n_ar_afip_responsibility_type_id") - - id_type = request.env['l10n_latam.identification.type'].browse(id_type_id) if id_type_id else False - afip_resp = request.env['l10n_ar.afip.responsibility.type'].browse(afip_resp_id) if afip_resp_id else False - cuit_id_type = request.env.ref('l10n_ar.it_cuit') - - # Check if the AFIP responsibility is different from Final Consumer or Foreign Customer, - # and if the identification type is different from CUIT - if afip_resp.code not in ['5', '9'] and id_type != cuit_id_type: - error["l10n_latam_identification_type_id"] = 'error' - error_message.append(_('For the selected AFIP Responsibility you will need to set CUIT Identification Type')) - - return error, error_message diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/data/ir_model_fields.xml b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/data/ir_model_fields.xml deleted file mode 100644 index fa73c00..0000000 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/data/ir_model_fields.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - res.partner - - - - diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/demo/website_demo.xml b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/demo/website_demo.xml deleted file mode 100644 index ff35d98..0000000 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/demo/website_demo.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - (AR) Responsable Inscripto Website - - - - - - - - - - - - - - - - - - diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/es.po b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/es.po deleted file mode 100644 index b9b15a4..0000000 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/es.po +++ /dev/null @@ -1,86 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * l10n_ar_website_sale -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0+e\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 10:56+0000\n" -"PO-Revision-Date: 2024-11-15 10:56+0000\n" -"Last-Translator: María Fernanda Alvarez Ramírez \n" -"Language-Team: \n" -"Language: es\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. module: l10n_ar_website_sale -#: model:website,contact_us_button_url:l10n_ar_website_sale.default_website_ri -msgid "/contactus" -msgstr "/contacto" - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "" -msgstr "" - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "" -msgstr "" - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "AFIP Responsibility" -msgstr "Responsabilidad AFIP" - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "" -"Changing AFIP Responsibility type is not allowed once document(s) have been " -"issued for your account. Please contact us directly for this operation." -msgstr "" -"No puede cambiar el tipo de responsabilidad AFIP después de que haya emitido " -"documentos para su cuenta. Contáctenos para realizar esta operación." - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "" -"Changing Identification type is not allowed once document(s) have been " -"issued for your account. Please contact us directly for this operation." -msgstr "" -"No puede cambiar el tipo de identificación después de que haya emitido " -"documentos para su cuenta. Contáctenos para realizar esta operación." - -#. module: l10n_ar_website_sale -#. odoo-python -#: code:addons/l10n_ar_website_sale/controllers/main.py:0 -#, python-format -msgid "" -"For the selected AFIP Responsibility you will need to set CUIT " -"Identification Type" -msgstr "" -"Para la responsabilidad AFIP seleccionada debe elegir el tipo de " -"identificación CUIT" - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "Identification Type" -msgstr "Tipo de identificación" - -#. module: l10n_ar_website_sale -#: model:website,prevent_zero_price_sale_text:l10n_ar_website_sale.default_website_ri -msgid "Not Available For Sale" -msgstr "No está disponible para la venta" - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.address -msgid "Number" -msgstr "Número" - -#. module: l10n_ar_website_sale -#: model:ir.model,name:l10n_ar_website_sale.model_website -msgid "Website" -msgstr "Sitio web" diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/es_419.po b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/es_419.po new file mode 100644 index 0000000..640563b --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/es_419.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ar_website_sale +# +# "Fernanda Alvarez (mfar)" , 2026. +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.4a1+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-30 19:04+0000\n" +"PO-Revision-Date: 2026-01-31 10:05+0000\n" +"Last-Translator: \"Fernanda Alvarez (mfar)\" \n" +"Language-Team: Spanish (Latin America) \n" +"Language: es_419\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.14.3\n" + +#. module: l10n_ar_website_sale +#: model:ir.model,name:l10n_ar_website_sale.model_res_config_settings +msgid "Config Settings" +msgstr "Ajustes de configuración" + +#. module: l10n_ar_website_sale +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_product_template__display_name +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_website__display_name +msgid "Display Name" +msgstr "Nombre Mostrado" + +#. module: l10n_ar_website_sale +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_res_config_settings__l10n_ar_website_sale_show_both_prices +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_website__l10n_ar_website_sale_show_both_prices +msgid "Display Price without National Taxes" +msgstr "Mostrar Precio sin Impuestos Nacionales" + +#. module: l10n_ar_website_sale +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_product_template__id +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_res_config_settings__id +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_website__id +msgid "ID" +msgstr "ID" + +#. module: l10n_ar_website_sale +#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.l10n_ar_website_sale_products_item_inherit +msgid "Precio s/Imp. Nac." +msgstr "Precio s/Imp. Nac." + +#. module: l10n_ar_website_sale +#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.l10n_ar_website_sale_product_price_inherit +msgid "Precio s/Imp. Nac.:" +msgstr "Precio s/Imp. Nac.:" + +#. module: l10n_ar_website_sale +#: model:ir.model,name:l10n_ar_website_sale.model_product_template +msgid "Product" +msgstr "Producto" + +#. module: l10n_ar_website_sale +#: model:ir.model,name:l10n_ar_website_sale.model_website +msgid "Website" +msgstr "Website" diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/l10n_ar_website_sale.pot b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/l10n_ar_website_sale.pot index edc7737..97e93d1 100644 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/l10n_ar_website_sale.pot +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/i18n/l10n_ar_website_sale.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0+e\n" +"Project-Id-Version: Odoo Server 19.0+e\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 10:56+0000\n" -"PO-Revision-Date: 2024-11-15 10:56+0000\n" +"POT-Creation-Date: 2025-12-30 19:04+0000\n" +"PO-Revision-Date: 2025-12-30 19:04+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,61 +16,43 @@ msgstr "" "Plural-Forms: \n" #. module: l10n_ar_website_sale -#: model:website,contact_us_button_url:l10n_ar_website_sale.default_website_ri -msgid "/contactus" +#: model:ir.model,name:l10n_ar_website_sale.model_res_config_settings +msgid "Config Settings" msgstr "" #. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "" +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_product_template__display_name +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_website__display_name +msgid "Display Name" msgstr "" #. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "" +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_res_config_settings__l10n_ar_website_sale_show_both_prices +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_website__l10n_ar_website_sale_show_both_prices +msgid "Display Price without National Taxes" msgstr "" #. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "AFIP Responsibility" +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_product_template__id +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_res_config_settings__id +#: model:ir.model.fields,field_description:l10n_ar_website_sale.field_website__id +msgid "ID" msgstr "" #. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "" -"Changing AFIP Responsibility type is not allowed once document(s) have been " -"issued for your account. Please contact us directly for this operation." +#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.l10n_ar_website_sale_products_item_inherit +msgid "Precio s/Imp. Nac." msgstr "" #. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "" -"Changing Identification type is not allowed once document(s) have been " -"issued for your account. Please contact us directly for this operation." +#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.l10n_ar_website_sale_product_price_inherit +msgid "Precio s/Imp. Nac.:" msgstr "" #. module: l10n_ar_website_sale -#. odoo-python -#: code:addons/l10n_ar_website_sale/controllers/main.py:0 -#, python-format -msgid "" -"For the selected AFIP Responsibility you will need to set CUIT " -"Identification Type" -msgstr "" - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.partner_info -msgid "Identification Type" -msgstr "" - -#. module: l10n_ar_website_sale -#: model:website,prevent_zero_price_sale_text:l10n_ar_website_sale.default_website_ri -msgid "Not Available For Sale" -msgstr "" - -#. module: l10n_ar_website_sale -#: model_terms:ir.ui.view,arch_db:l10n_ar_website_sale.address -msgid "Number" +#: model:ir.model,name:l10n_ar_website_sale.model_product_template +msgid "Product" msgstr "" #. module: l10n_ar_website_sale diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/__init__.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/__init__.py index 91fe9bd..25d3d18 100644 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/__init__.py +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - +from . import product_template +from . import res_config_settings from . import website -from . import sale_order diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/product_template.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/product_template.py new file mode 100644 index 0000000..4cd75bb --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/product_template.py @@ -0,0 +1,79 @@ +from odoo import models +from odoo.http import request + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + def _get_sales_prices(self, website): + ''' + Resolution 4/2025 requires us to display both prices on the e-commerce site: + - Price including taxes + - Price excluding taxes + + If the website is configured to use tax-included pricing, we calculate the tax-excluded + price separately. This tax-excluded price is displayed on the shop page (on both list and grid views). + ''' + + res = super()._get_sales_prices(website) + fiscal_position_id = request.fiscal_position + pricelist_prices = request.pricelist._compute_price_rule(self, 1.0) + + if ( + website + and website.company_id.country_code == 'AR' + and website.l10n_ar_website_sale_show_both_prices + and website.show_line_subtotals_tax_selection == 'tax_included' + ): + for template_id, template_val in res.items(): + # Get applicable taxes for the product and map them using the website's FPOS + template = self.env['product.template'].browse(template_id) + product_taxes = template.sudo().taxes_id._filter_taxes_by_company(self.env.company) + mapped_taxes = fiscal_position_id.map_tax(product_taxes) + + # Compute the tax-excluded value + total_excluded_value = mapped_taxes.compute_all( + price_unit=pricelist_prices[template.id][0], + currency=website.currency_id, + product=template, + )['total_excluded'] + + # Store the tax-excluded price in the res for use in showing both prices + res[template_id]['l10n_ar_price_tax_excluded'] = total_excluded_value + + return res + + def _get_additionnal_combination_info(self, product_or_template, quantity, uom, date, website): + combination_info = super()._get_additionnal_combination_info( + product_or_template, quantity, uom, date, website + ) + if ( + website + and website.company_id.country_code == 'AR' + and website.l10n_ar_website_sale_show_both_prices + and website.show_line_subtotals_tax_selection == 'tax_included' + ): + # Get applicable taxes for the product and map them using the website's FPOS + product_taxes = product_or_template.sudo().taxes_id._filter_taxes_by_company(self.env.company) + mapped_taxes = request.fiscal_position.map_tax(product_taxes) + + # Compute price per unit of product or template + pricelist_prices = request.pricelist._compute_price_rule(product_or_template, quantity) + unit_price = pricelist_prices[product_or_template.id][0] + + # Compute the tax-excluded value + total_excluded_value = mapped_taxes.compute_all( + price_unit=unit_price, + currency=website.currency_id, + product=product_or_template, + )['total_excluded'] + + # Check if a discount is applied and adjust the tax-excluded price accordingly + if combination_info['has_discounted_price']: + discount_percent = (combination_info['list_price'] - combination_info['price']) / combination_info['list_price'] + total_excluded_value = total_excluded_value * (1 - discount_percent) + + # Store the tax-excluded price in the res for use in showing both prices + combination_info['l10n_ar_price_tax_excluded'] = total_excluded_value + + return combination_info diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/res_config_settings.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/res_config_settings.py new file mode 100644 index 0000000..b226e1d --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/res_config_settings.py @@ -0,0 +1,11 @@ +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + # Website Dependent Settings + l10n_ar_website_sale_show_both_prices = fields.Boolean( + related='website_id.l10n_ar_website_sale_show_both_prices', + readonly=False, + ) diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/sale_order.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/sale_order.py deleted file mode 100644 index 3e54287..0000000 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/sale_order.py +++ /dev/null @@ -1,25 +0,0 @@ -import pytz - -from odoo import fields, models - - -class SaleOrder(models.Model): - _inherit = "sale.order" - - def _create_invoices(self, grouped=False, final=False, date=None): - """ EXTENDS 'sale' - Necessary because if someone creates an invoice after 9 pm Argentina time, if the invoice is created - automatically, then it is created with the date of the next day (UTC date) instead of today. - - This fix is necessary because it causes problems validating invoices in ARCA (ex AFIP), since when generating - the invoice with the date of the next day, no more invoices could be generated with today's date. - - We took the same approach that was used in the POS module to set the date, in this case always forcing the - Argentina timezone """ - invoices = super()._create_invoices(grouped=grouped, final=final, date=date) - for invoice in invoices: - if invoice.country_code == 'AR': - timezone = pytz.timezone('America/Buenos_Aires') - context_today_ar = fields.Datetime.now().astimezone(timezone).date() - invoice.invoice_date = context_today_ar - return invoices diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/website.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/website.py index 18c6fed..bbfbe50 100644 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/website.py +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/models/website.py @@ -1,13 +1,27 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import models +from odoo import api, fields, models class Website(models.Model): - _inherit = "website" + _inherit = 'website' - def _display_partner_b2b_fields(self): - """ Argentinean localization must always display b2b fields """ - self.ensure_one() - return self.company_id.country_id.code == "AR" or super()._display_partner_b2b_fields() + l10n_ar_website_sale_show_both_prices = fields.Boolean( + string="Display Price without National Taxes", + compute='_compute_l10n_ar_website_sale_show_both_prices', + readonly=False, + store=True, + ) + + @api.depends('company_id') + def _compute_l10n_ar_website_sale_show_both_prices(self): + for website in self: + website.l10n_ar_website_sale_show_both_prices = ( + website.company_id.account_fiscal_country_id.code == 'AR' + ) + + @api.depends('company_id.account_fiscal_country_id') + def _compute_show_line_subtotals_tax_selection(self): + # EXTENDS 'website_sale' + super()._compute_show_line_subtotals_tax_selection() + for website in self: + if website.company_id.account_fiscal_country_id.code == 'AR': + website.show_line_subtotals_tax_selection = 'tax_included' diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/description/icon.png b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/description/icon.png deleted file mode 100644 index b677ccb..0000000 Binary files a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/description/icon.png and /dev/null differ diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/src/interactions/website_sale.js b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/src/interactions/website_sale.js new file mode 100644 index 0000000..2e349c3 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/src/interactions/website_sale.js @@ -0,0 +1,22 @@ +import { patch } from '@web/core/utils/patch'; +import { WebsiteSale } from '@website_sale/interactions/website_sale'; + +patch(WebsiteSale.prototype, { + /** + * @override + * Updates the product's excluded price based on the selected variant. + * Ensuring availability info stays accurate. + */ + _onChangeCombination(ev, parent, combination) { + super._onChangeCombination(...arguments); + const currencyValue = parent.querySelector( + '.o_l10n_ar_price_tax_excluded .oe_currency_value' + ); + if (currencyValue) { + const { currency_precision, l10n_ar_price_tax_excluded } = combination; + currencyValue.textContent = this._priceToStr( + l10n_ar_price_tax_excluded, currency_precision, + ); + } + }, +}) diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/src/scss/product_configurator.scss b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/src/scss/product_configurator.scss new file mode 100644 index 0000000..4b52d92 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/static/src/scss/product_configurator.scss @@ -0,0 +1,11 @@ +.o_wsale_products_opt_layout_list{ + .o_wsale_product_sub{ + .o_wsale_product_btn:has(.btn) + .o_l10n_ar_product_price { + text-align: end; + } + .o_wsale_product_btn:not(:has(.btn)) + .o_l10n_ar_product_price { + text-align: start; + } + + } +} diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/__init__.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/__init__.py index 26d048f..55b9ebd 100644 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/__init__.py +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/__init__.py @@ -1 +1 @@ -from . import test_invoice +from . import test_l10n_ar_website_sale diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/test_invoice.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/test_invoice.py deleted file mode 100644 index 850cd59..0000000 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/test_invoice.py +++ /dev/null @@ -1,45 +0,0 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import fields -from odoo.tests import tagged -from odoo.tools import mute_logger -from freezegun import freeze_time - -from odoo.addons.account_payment.tests.common import AccountPaymentCommon -from odoo.addons.sale.tests.common import SaleCommon -from odoo.addons.l10n_ar.tests.common import TestAr - - -@tagged('-at_install', 'post_install', 'post_install_l10n') -class TestWebsiteSaleInvoice(AccountPaymentCommon, SaleCommon, TestAr): - - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.website = cls.env['website'].create({'name': 'Test AR Website'}) - - def test_website_automatic_invoice_date(self): - # Set automatic invoice - self.env['ir.config_parameter'].sudo().set_param('sale.automatic_invoice', 'True') - self.frozen_today = "2025-01-24T21:10:00" - with freeze_time(self.frozen_today, tz_offset=3): - - # Prepare values needed for AR invoice generation: Tax in all lines, and AFIP responsibility partner - self.sale_order.order_line.write({'tax_id': self.company_data['default_tax_sale']}) - self.sale_order.partner_id = self.partner_cf - self.sale_order.currency_id = self.env.ref('base.ARS') - - # Create SO on Test Website - self.sale_order.website_id = self.website.id - - # Create the payment and invoices - self.amount = self.sale_order.amount_total - tx = self._create_transaction(flow='redirect', sale_order_ids=[self.sale_order.id], state='done') - with mute_logger('odoo.addons.sale.models.payment_transaction'): - tx.with_context(l10n_ar_invoice_skip_commit=True)._reconcile_after_done() - - invoice = self.sale_order.invoice_ids - self.assertTrue(invoice, "Do not create the invoice") - self.assertEqual(invoice.state, "posted", "the invoice was not posted") - self.assertEqual(fields.Datetime.now().date().strftime("%Y-%m-%d"), '2025-01-25', "UCT should be next day") - self.assertEqual(invoice.invoice_date.strftime('%Y-%m-%d'), '2025-01-24', "Should be AR current date") diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/test_l10n_ar_website_sale.py b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/test_l10n_ar_website_sale.py new file mode 100644 index 0000000..fbf6b74 --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/tests/test_l10n_ar_website_sale.py @@ -0,0 +1,150 @@ +from datetime import datetime + +from odoo.fields import Command +from odoo.tests import tagged + +from odoo.addons.l10n_ar.tests.common import TestArCommon +from odoo.addons.website_sale.tests.common import MockRequest + + +@tagged('post_install_l10n', 'post_install', '-at_install') +class TestL10nArWebsiteSale(TestArCommon): + + @classmethod + def setUpClass(cls): + super().setUpClass() + + # Set up Argentina-specific test company and website + cls.ar_company = cls.company_data['company'] + cls.ar_website = cls.env['website'].create({ + 'name': 'AR Website', + 'company_id': cls.ar_company.id, + }) + + # Create a base product template with default tax + cls.product_1 = cls.env['product.template'].create({ + 'name': 'Product 1', + 'is_published': True, + 'list_price': 1000, + 'taxes_id': cls.env['account.chart.template'].ref('ri_tax_vat_21_ventas'), + }) + + # Create color attribute and values + cls.color_attribute = cls.env['product.attribute'].create({ + 'name': 'Color', + 'display_type': 'color', + }) + cls.color_white = cls.env['product.attribute.value'].create({ + 'name': 'White', + 'html_color': '#FFFFFF', + 'attribute_id': cls.color_attribute.id, + }) + cls.color_black = cls.env['product.attribute.value'].create({ + 'name': 'Black', + 'html_color': '#000000', + 'attribute_id': cls.color_attribute.id, + }) + + def assertDictContains(self, actual_dict, expected_subset): + """Assert that actual_dict contains all key-value pairs from expected_subset.""" + for key, expected_value in expected_subset.items(): + self.assertEqual(actual_dict.get(key), expected_value) + + def _get_combination_info(self, product_id=None, quantity=1): + """Helper method to retrieve combination info for a product.""" + with MockRequest(self.env, website=self.ar_website): + return self.product_1._get_additionnal_combination_info( + product_or_template=product_id or self.product_1, + quantity=quantity, + uom=self.uom_unit, + date=datetime(2025, 5, 21), + website=self.ar_website + ) + + def test_default_website_sale_legal_values(self): + """Ensure legal default values are applied on AR website.""" + self.assertEqual(self.ar_website.l10n_ar_website_sale_show_both_prices, True) + self.assertEqual(self.ar_website.show_line_subtotals_tax_selection, 'tax_included') + + def test_price_calculation_with_tax_changes(self): + """Test list price and tax excluded price calculations for various tax setups.""" + with self.subTest(scenario="Single 21% VAT - tax excluded"): + combo = self._get_combination_info() + self.assertDictContains(combo, { + 'list_price': 1210.00, # 1000 + 21% + 'l10n_ar_price_tax_excluded': 1000.00, + }) + + with self.subTest(scenario="Mixed taxes - 10.5% excluded + 27% included"): + template = self.env['account.chart.template'] + tax_27_included = template.ref('ri_tax_vat_27_ventas') + tax_10_5_excluded = template.ref('ri_tax_vat_10_ventas') + + tax_27_included.price_include = True + tax_10_5_excluded.price_include = False + + self.product_1.taxes_id = (tax_27_included + tax_10_5_excluded).ids + combo = self._get_combination_info() + self.assertDictContains(combo, { + 'list_price': 1082.68, # Computed price including all taxes + 'l10n_ar_price_tax_excluded': 787.40, # Reverse calculated base price + }) + + def test_price_calculation_with_pricelist_rules(self): + """Check that pricelist rules are taken into account.""" + self._enable_pricelists() + self.pricelist.update({ + 'website_id': self.ar_website.id, + 'item_ids': [ + Command.create({ + 'compute_price': 'fixed', + 'fixed_price': 888.0, + 'min_quantity': 5.0, + 'applied_on': '1_product', + 'product_tmpl_id': self.product_1.id, + }), + Command.create({ + 'compute_price': 'formula', + 'price_surcharge': 2.0, + 'applied_on': '3_global', + }), + ], + }) + + info_qty_3 = self._get_combination_info(quantity=3) + self.assertEqual(info_qty_3['l10n_ar_price_tax_excluded'], 1002.0) + + info_qty_5 = self._get_combination_info(quantity=5) + self.assertEqual(info_qty_5['l10n_ar_price_tax_excluded'], 888.0) + + def test_product_variant_prices_with_attributes(self): + """Test variant-specific price calculation with color attribute values.""" + self.product_1.taxes_id = self.env['account.chart.template'].ref('ri_tax_vat_21_ventas') + + # Add attribute line and values to product template + attribute_line = self.env['product.template.attribute.line'].create({ + 'product_tmpl_id': self.product_1.id, + 'attribute_id': self.color_attribute.id, + 'value_ids': [(6, 0, [self.color_white.id, self.color_black.id])] + }) + + # Set price extras for each variant + attribute_line.product_template_value_ids[0].price_extra = 100 # White + attribute_line.product_template_value_ids[1].price_extra = 200 # Black + + white_variant = self.product_1.product_variant_ids[0] + black_variant = self.product_1.product_variant_ids[1] + + with self.subTest(scenario="White variant with 100 extra + 21% VAT"): + combo = self._get_combination_info(product_id=white_variant) + self.assertDictContains(combo, { + 'list_price': 1331.00, # (1000+100) + 21% + 'l10n_ar_price_tax_excluded': 1100.00, + }) + + with self.subTest(scenario="Black variant with 200 extra + 21% VAT"): + combo = self._get_combination_info(product_id=black_variant) + self.assertDictContains(combo, { + 'list_price': 1452.00, # (1000+200) + 21% + 'l10n_ar_price_tax_excluded': 1200.00, + }) diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/views/res_config_settings_views.xml b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/views/res_config_settings_views.xml new file mode 100644 index 0000000..f7379ad --- /dev/null +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/views/res_config_settings_views.xml @@ -0,0 +1,18 @@ + + + + + res.config.settings.view.form.inherit.website.sale + res.config.settings + + + +
+ +
+
+
+
+ +
diff --git a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/views/templates.xml b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/views/templates.xml index e9cb684..485b6ed 100644 --- a/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/views/templates.xml +++ b/odoo-bringout-oca-ocb-l10n_ar_website_sale/l10n_ar_website_sale/views/templates.xml @@ -1,63 +1,39 @@ -