diff --git a/account_chart_update_l10n_eu_oss_oca/README.rst b/account_chart_update_l10n_eu_oss_oca/README.rst new file mode 100644 index 00000000..fcead6e2 --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/README.rst @@ -0,0 +1,85 @@ +============================ +Account Chart update OSS OCA +============================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :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/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/16.0 + :alt: Try me on Runbot + +|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. + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ForgeFlow + +Contributors +~~~~~~~~~~~~ + +* Lois Rilo +* `Factor Libre `_: + + * Luis J. Salvatierra + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px + :target: https://github.com/LoisRForgeFlow + :alt: LoisRForgeFlow + +Current `maintainer `__: + +|maintainer-LoisRForgeFlow| + +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/__init__.py b/account_chart_update_l10n_eu_oss_oca/__init__.py new file mode 100644 index 00000000..40272379 --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/__init__.py @@ -0,0 +1 @@ +from . import wizard diff --git a/account_chart_update_l10n_eu_oss_oca/__manifest__.py b/account_chart_update_l10n_eu_oss_oca/__manifest__.py new file mode 100644 index 00000000..4eb1b0b8 --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Account Chart update OSS OCA", + "version": "16.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "maintainers": ["LoisRForgeFlow"], + "website": "https://github.com/OCA/account-financial-tools", + "category": "Accounting", + "license": "AGPL-3", + "depends": [ + "account_chart_update", + "l10n_eu_oss_oca", + ], + "installable": True, + "auto_install": True, +} 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 new file mode 100644 index 00000000..9bcfae77 --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/i18n/account_chart_update_l10n_eu_oss_oca.pot @@ -0,0 +1,19 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_chart_update_l10n_eu_oss_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_chart_update_l10n_eu_oss_oca +#: model:ir.model,name:account_chart_update_l10n_eu_oss_oca.model_wizard_update_charts_accounts +msgid "Wizard Update Charts Accounts" +msgstr "" diff --git a/account_chart_update_l10n_eu_oss_oca/readme/CONTRIBUTORS.rst b/account_chart_update_l10n_eu_oss_oca/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..4502aab4 --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Lois Rilo +* `Factor Libre `_: + + * Luis J. Salvatierra diff --git a/account_chart_update_l10n_eu_oss_oca/readme/DESCRIPTION.rst b/account_chart_update_l10n_eu_oss_oca/readme/DESCRIPTION.rst new file mode 100644 index 00000000..117c62da --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Glue module for account chart update and OSS (OCA version). It makes the wizard +ignore OSS taxes when updating the CoA. diff --git a/account_chart_update_l10n_eu_oss_oca/static/description/icon.png b/account_chart_update_l10n_eu_oss_oca/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_chart_update_l10n_eu_oss_oca/static/description/icon.png differ diff --git a/account_chart_update_l10n_eu_oss_oca/static/description/index.html b/account_chart_update_l10n_eu_oss_oca/static/description/index.html new file mode 100644 index 00000000..5f0c0dd2 --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/static/description/index.html @@ -0,0 +1,422 @@ + + + + + + +Account Chart update OSS OCA + + + +
+

Account Chart update OSS OCA

+ + +

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runbot

+

Glue module for account chart update and OSS (OCA version). It makes the wizard +ignore OSS taxes when updating the CoA.

+

Table of contents

+ +
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

LoisRForgeFlow

+

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/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) diff --git a/account_chart_update_l10n_eu_oss_oca/wizard/__init__.py b/account_chart_update_l10n_eu_oss_oca/wizard/__init__.py new file mode 100644 index 00000000..fbd95d57 --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/wizard/__init__.py @@ -0,0 +1 @@ +from . import wizard_chart_update diff --git a/account_chart_update_l10n_eu_oss_oca/wizard/wizard_chart_update.py b/account_chart_update_l10n_eu_oss_oca/wizard/wizard_chart_update.py new file mode 100644 index 00000000..d43a045c --- /dev/null +++ b/account_chart_update_l10n_eu_oss_oca/wizard/wizard_chart_update.py @@ -0,0 +1,13 @@ +# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class WizardUpdateChartsAccounts(models.TransientModel): + _inherit = "wizard.update.charts.accounts" + + def _domain_taxes_to_deactivate(self, found_taxes_ids): + domain = super()._domain_taxes_to_deactivate(found_taxes_ids) + domain.append(("oss_country_id", "=", False)) + return domain diff --git a/setup/account_chart_update_l10n_eu_oss_oca/odoo/addons/account_chart_update_l10n_eu_oss_oca b/setup/account_chart_update_l10n_eu_oss_oca/odoo/addons/account_chart_update_l10n_eu_oss_oca new file mode 120000 index 00000000..8044e1d0 --- /dev/null +++ b/setup/account_chart_update_l10n_eu_oss_oca/odoo/addons/account_chart_update_l10n_eu_oss_oca @@ -0,0 +1 @@ +../../../../account_chart_update_l10n_eu_oss_oca \ No newline at end of file diff --git a/setup/account_chart_update_l10n_eu_oss_oca/setup.py b/setup/account_chart_update_l10n_eu_oss_oca/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/account_chart_update_l10n_eu_oss_oca/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)