diff --git a/account_chart_update_l10n_eu_oss_oca/README.rst b/account_chart_update_l10n_eu_oss_oca/README.rst index cfe82a74..fcead6e2 100644 --- a/account_chart_update_l10n_eu_oss_oca/README.rst +++ b/account_chart_update_l10n_eu_oss_oca/README.rst @@ -14,16 +14,16 @@ Account Chart update OSS OCA :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github - :target: https://github.com/OCA/account-financial-tools/tree/15.0/account_chart_update_l10n_eu_oss_oca + :target: https://github.com/OCA/account-financial-tools/tree/16.0/account_chart_update_l10n_eu_oss_oca :alt: OCA/account-financial-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/account-financial-tools-15-0/account-financial-tools-15-0-account_chart_update_l10n_eu_oss_oca :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/92/15.0 + :target: https://runbot.odoo-community.org/runbot/92/16.0 :alt: Try me on Runbot -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| Glue module for account chart update and OSS (OCA version). It makes the wizard ignore OSS taxes when updating the CoA. @@ -39,7 +39,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -55,6 +55,9 @@ Contributors ~~~~~~~~~~~~ * Lois Rilo +* `Factor Libre `_: + + * Luis J. Salvatierra Maintainers ~~~~~~~~~~~ @@ -75,8 +78,8 @@ promote its widespread use. Current `maintainer `__: -|maintainer-LoisRForgeFlow| +|maintainer-LoisRForgeFlow| -This module is part of the `OCA/account-financial-tools `_ project on GitHub. +This module is part of the `OCA/account-financial-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_chart_update_l10n_eu_oss_oca/__manifest__.py b/account_chart_update_l10n_eu_oss_oca/__manifest__.py index 066e0294..4eb1b0b8 100644 --- a/account_chart_update_l10n_eu_oss_oca/__manifest__.py +++ b/account_chart_update_l10n_eu_oss_oca/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Account Chart update OSS OCA", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "author": "ForgeFlow, Odoo Community Association (OCA)", "maintainers": ["LoisRForgeFlow"], "website": "https://github.com/OCA/account-financial-tools", diff --git a/account_chart_update_l10n_eu_oss_oca/i18n/account_chart_update_l10n_eu_oss_oca.pot b/account_chart_update_l10n_eu_oss_oca/i18n/account_chart_update_l10n_eu_oss_oca.pot index c821b9c4..9bcfae77 100644 --- a/account_chart_update_l10n_eu_oss_oca/i18n/account_chart_update_l10n_eu_oss_oca.pot +++ b/account_chart_update_l10n_eu_oss_oca/i18n/account_chart_update_l10n_eu_oss_oca.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/account_chart_update_l10n_eu_oss_oca/readme/CONTRIBUTORS.rst b/account_chart_update_l10n_eu_oss_oca/readme/CONTRIBUTORS.rst index 77dfbe89..4502aab4 100644 --- a/account_chart_update_l10n_eu_oss_oca/readme/CONTRIBUTORS.rst +++ b/account_chart_update_l10n_eu_oss_oca/readme/CONTRIBUTORS.rst @@ -1 +1,4 @@ * Lois Rilo +* `Factor Libre `_: + + * Luis J. Salvatierra diff --git a/account_chart_update_l10n_eu_oss_oca/tests/__init__.py b/account_chart_update_l10n_eu_oss_oca/tests/__init__.py new file mode 100644 index 00000000..7497f264 --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/tests/__init__.py @@ -0,0 +1 @@ +from . import test_account_chart_update_l10n_eu_oss_oca diff --git a/account_chart_update_l10n_eu_oss_oca/tests/test_account_chart_update_l10n_eu_oss_oca.py b/account_chart_update_l10n_eu_oss_oca/tests/test_account_chart_update_l10n_eu_oss_oca.py new file mode 100644 index 00000000..56f6329f --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/tests/test_account_chart_update_l10n_eu_oss_oca.py @@ -0,0 +1,135 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests import tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("post_install", "-at_install") +class TestOSSCoA(AccountTestInvoicingCommon): + def _create_xml_id(self, record): + return self.env["ir.model.data"].create( + { + "module": "account_chart_update", + "name": "{}-{}".format(record._table, record.id), + "model": record._name, + "res_id": record.id, + } + ) + + def _create_tax_tmpl(self, name, chart_template): + record = self.env["account.tax.template"].create( + { + "name": name, + "amount": 0, + "chart_template_id": chart_template.id, + "tax_group_id": self.env.ref("account.tax_group_taxes").id, + "refund_repartition_line_ids": [ + (0, 0, {"repartition_type": "base", "factor_percent": 100.0}), + (0, 0, {"repartition_type": "tax", "factor_percent": 100.0}), + (0, 0, {"repartition_type": "tax", "factor_percent": 100.0}), + ], + "invoice_repartition_line_ids": [ + (0, 0, {"repartition_type": "base", "factor_percent": 100.0}), + (0, 0, {"repartition_type": "tax", "factor_percent": 100.0}), + (0, 0, {"repartition_type": "tax", "factor_percent": 100.0}), + ], + } + ) + self._create_xml_id(record) + return record + + # pylint: disable=W8106 + @classmethod + def setUpClass( + cls, chart_template_ref="l10n_generic_coa.configurable_chart_template" + ): + super().setUpClass(chart_template_ref=chart_template_ref) + cls.chart_template = cls.env.ref(chart_template_ref) + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) + cls.company = cls.env["res.company"].create( + { + "name": "Test account_chart_update company", + "currency_id": cls.chart_template.currency_id.id, + "country_id": cls.env.ref("base.es").id, + } + ) + cls.env.user.write( + { + "company_ids": [ + (6, 0, cls.env.user.company_ids.ids), + (4, cls.company.id), + ], + "company_id": cls.company.id, + "groups_id": [ + (6, 0, cls.env.user.groups_id.ids), + (4, cls.env.ref("account.group_account_user").id), + (4, cls.env.ref("account.group_account_invoice").id), + (4, cls.env.ref("base.group_multi_company").id), + ], + } + ) + cls.oss_wizard = cls.env["l10n.eu.oss.wizard"] + + def setUp(self): + super().setUp() + # Create demo tax + self._create_tax_tmpl("Not OSS Demo tax", self.chart_template) + self.tax = self.env["account.tax"].create( + { + "name": "Not OSS Demo tax", + "amount": 10, + "amount_type": "percent", + "type_tax_use": "sale", + "country_id": self.env.ref("base.es").id, + "company_id": self.company.id, + "tax_group_id": self.env.ref("account.tax_group_taxes").id, + } + ) + self.wizard_obj = self.env["wizard.update.charts.accounts"] + self.wizard_vals = { + "company_id": self.company.id, + "chart_template_id": self.chart_template.id, + "code_digits": 6, + "lang": "en_US", + } + + @classmethod + def _oss_wizard_create(cls, extra_vals): + vals = cls.oss_wizard.default_get(list(cls.oss_wizard.fields_get())) + vals.update(extra_vals) + oss_wizard_id = cls.oss_wizard.create(vals) + return oss_wizard_id + + def test_matching(self): + # Generate EU OSS taxes + oss_wizard_vals = { + "company_id": self.company.id, + "general_tax": self.tax.id, + } + oss_wizard = self._oss_wizard_create(oss_wizard_vals) + oss_wizard.generate_eu_oss_taxes() + + wizard_vals = self.wizard_vals + wizard_vals.update(update_tax=True) + wizard = self.wizard_obj.create(wizard_vals) + wizard.action_find_records() + taxes_to_delete = wizard.tax_ids.filtered(lambda x: x.type == "deleted").mapped( + "update_tax_id" + ) + oss_taxes = self.env["account.tax"].search( + [ + ("oss_country_id", "!=", False), + ] + ) + self.assertTrue(oss_taxes, "No OSS taxes found in the system") + for tax in oss_taxes: + self.assertNotIn(tax, taxes_to_delete)