diff --git a/remove_odoo_enterprise/README.rst b/remove_odoo_enterprise/README.rst new file mode 100644 index 0000000..8bc5c36 --- /dev/null +++ b/remove_odoo_enterprise/README.rst @@ -0,0 +1,86 @@ +====================== +Remove Odoo Enterprise +====================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5a1f12d8590afb4f5c4e395ad3ef44a2368993dd60e0d4d94c5b20e2aaf5120b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fserver--brand-lightgray.png?logo=github + :target: https://github.com/OCA/server-brand/tree/18.0/remove_odoo_enterprise + :alt: OCA/server-brand +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-brand-18-0/server-brand-18-0-remove_odoo_enterprise + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/server-brand&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module removes enterprise-only apps and features from all settings +views. + +It also removes the widget in the General Settings page for downloading +the Odoo mobile apps from Google Play and Apple Store. + +**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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Eska +* Onestein + +Contributors +------------ + +- Brett Wood +- Michell Stuttgart +- Andrea Stirpe +- Levent Karakaş +- Dennis Sluijk +- remi-filament + +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. + +This module is part of the `OCA/server-brand `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/remove_odoo_enterprise/__init__.py b/remove_odoo_enterprise/__init__.py new file mode 100644 index 0000000..e919847 --- /dev/null +++ b/remove_odoo_enterprise/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2018 Eska Yazılım ve Danışmanlık A.Ş (www.eskayazilim.com.tr) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/remove_odoo_enterprise/__manifest__.py b/remove_odoo_enterprise/__manifest__.py new file mode 100644 index 0000000..1b8fbe5 --- /dev/null +++ b/remove_odoo_enterprise/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2018 Eska Yazılım ve Danışmanlık A.Ş (www.eskayazilim.com.tr) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Remove Odoo Enterprise", + "summary": "Remove enterprise modules and setting items", + "version": "18.0.1.0.0", + "category": "Maintenance", + "author": "Eska, Onestein, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/server-brand", + "license": "AGPL-3", + "depends": ["base_setup"], + "data": ["views/res_config_settings_views.xml"], + "installable": True, +} diff --git a/remove_odoo_enterprise/i18n/hr.po b/remove_odoo_enterprise/i18n/hr.po new file mode 100644 index 0000000..82378ce --- /dev/null +++ b/remove_odoo_enterprise/i18n/hr.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * remove_odoo_enterprise +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-11-18 14:35+0000\n" +"Last-Translator: Bole \n" +"Language-Team: none\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.8\n" + +#. module: remove_odoo_enterprise +#: model:ir.model,name:remove_odoo_enterprise.model_base +msgid "Base" +msgstr "" + +#. module: remove_odoo_enterprise +#: model:ir.model,name:remove_odoo_enterprise.model_res_config_settings +msgid "Config Settings" +msgstr "Postavke" diff --git a/remove_odoo_enterprise/i18n/it.po b/remove_odoo_enterprise/i18n/it.po new file mode 100644 index 0000000..c3905aa --- /dev/null +++ b/remove_odoo_enterprise/i18n/it.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * remove_odoo_enterprise +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-02 17:34+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\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 4.17\n" + +#. module: remove_odoo_enterprise +#: model:ir.model,name:remove_odoo_enterprise.model_base +msgid "Base" +msgstr "Base" + +#. module: remove_odoo_enterprise +#: model:ir.model,name:remove_odoo_enterprise.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni configurazione" + +#~ msgid "Module" +#~ msgstr "Modulo" diff --git a/remove_odoo_enterprise/i18n/remove_odoo_enterprise.pot b/remove_odoo_enterprise/i18n/remove_odoo_enterprise.pot new file mode 100644 index 0000000..4e3f2b6 --- /dev/null +++ b/remove_odoo_enterprise/i18n/remove_odoo_enterprise.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * remove_odoo_enterprise +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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: remove_odoo_enterprise +#: model:ir.model,name:remove_odoo_enterprise.model_base +msgid "Base" +msgstr "" + +#. module: remove_odoo_enterprise +#: model:ir.model,name:remove_odoo_enterprise.model_res_config_settings +msgid "Config Settings" +msgstr "" diff --git a/remove_odoo_enterprise/i18n/sv.po b/remove_odoo_enterprise/i18n/sv.po new file mode 100644 index 0000000..f26534d --- /dev/null +++ b/remove_odoo_enterprise/i18n/sv.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * remove_odoo_enterprise +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-11-17 10:36+0000\n" +"Last-Translator: Simon S \n" +"Language-Team: none\n" +"Language: sv\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 4.3.2\n" + +#. module: remove_odoo_enterprise +#: model:ir.model,name:remove_odoo_enterprise.model_base +msgid "Base" +msgstr "Bas" + +#. module: remove_odoo_enterprise +#: model:ir.model,name:remove_odoo_enterprise.model_res_config_settings +msgid "Config Settings" +msgstr "Konfigurationsinställningar" + +#~ msgid "Module" +#~ msgstr "Modul" + +#~ msgid "Display Name" +#~ msgstr "Visningsnamn" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Senast ändrad den" diff --git a/remove_odoo_enterprise/models/__init__.py b/remove_odoo_enterprise/models/__init__.py new file mode 100644 index 0000000..a257f60 --- /dev/null +++ b/remove_odoo_enterprise/models/__init__.py @@ -0,0 +1,6 @@ +# Copyright 2018 Eska Yazılım ve Danışmanlık A.Ş (www.eskayazilim.com.tr) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + + +from . import base +from . import res_config_settings diff --git a/remove_odoo_enterprise/models/base.py b/remove_odoo_enterprise/models/base.py new file mode 100644 index 0000000..d683d56 --- /dev/null +++ b/remove_odoo_enterprise/models/base.py @@ -0,0 +1,18 @@ +# Copyright 2019-2020 Onestein () +# Copyright 2023 Le Filament (https://le-filament.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class Base(models.AbstractModel): + _inherit = "base" + + @api.model + def search_fetch(self, domain, field_names, offset=0, limit=None, order=None): + res = super().search_fetch(domain, field_names, offset, limit, order) + if self._name == "ir.module.module": + res = res.filtered(lambda a: not a.to_buy) + elif self._name == "payment.provider": + res = res.filtered(lambda a: not a.module_to_buy) + return res diff --git a/remove_odoo_enterprise/models/res_config_settings.py b/remove_odoo_enterprise/models/res_config_settings.py new file mode 100644 index 0000000..9030c5b --- /dev/null +++ b/remove_odoo_enterprise/models/res_config_settings.py @@ -0,0 +1,46 @@ +# Copyright 2016 LasLabs Inc. +# Copyright 2018-2020 Onestein () +# Copyright 2023 Le Filament (https://le-filament.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from lxml import etree + +from odoo import api, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + @api.model + def get_views(self, views, options=None): + ret_val = super().get_views(views, options) + + form_view = self.env["ir.ui.view"].browse(ret_val["views"]["form"]["id"]) + if not form_view.xml_id == "base.res_config_settings_view_form": + return ret_val + + doc = etree.XML(ret_val["views"]["form"]["arch"]) + + query = "//setting[field[@widget='upgrade_boolean']]" + for item in doc.xpath(query): + item.attrib["class"] = "d-none" + + for block in doc.xpath("//block"): + if ( + len( + block.xpath( + """setting[ + not(contains(@class, 'd-none')) + and not(@invisible='1')] + """ + ) + ) + == 0 + ): + # Removing title and tip so that no empty h2 or h3 are displayed + block.attrib.pop("title", None) + block.attrib.pop("tip", None) + block.attrib["class"] = "d-none" + + ret_val["views"]["form"]["arch"] = etree.tostring(doc) + return ret_val diff --git a/remove_odoo_enterprise/pyproject.toml b/remove_odoo_enterprise/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/remove_odoo_enterprise/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/remove_odoo_enterprise/readme/CONTRIBUTORS.md b/remove_odoo_enterprise/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..4a3e99c --- /dev/null +++ b/remove_odoo_enterprise/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- Brett Wood \<\> +- Michell Stuttgart \<\> +- Andrea Stirpe \<\> +- Levent Karakaş \<\> +- Dennis Sluijk \<\> +- remi-filament diff --git a/remove_odoo_enterprise/readme/DESCRIPTION.md b/remove_odoo_enterprise/readme/DESCRIPTION.md new file mode 100644 index 0000000..7786f4d --- /dev/null +++ b/remove_odoo_enterprise/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +This module removes enterprise-only apps and features from all settings +views. + +It also removes the widget in the General Settings page for downloading +the Odoo mobile apps from Google Play and Apple Store. diff --git a/remove_odoo_enterprise/static/description/icon.png b/remove_odoo_enterprise/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/remove_odoo_enterprise/static/description/icon.png differ diff --git a/remove_odoo_enterprise/static/description/index.html b/remove_odoo_enterprise/static/description/index.html new file mode 100644 index 0000000..f071fb9 --- /dev/null +++ b/remove_odoo_enterprise/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +Remove Odoo Enterprise + + + +
+

Remove Odoo Enterprise

+ + +

Beta License: AGPL-3 OCA/server-brand Translate me on Weblate Try me on Runboat

+

This module removes enterprise-only apps and features from all settings +views.

+

It also removes the widget in the General Settings page for downloading +the Odoo mobile apps from Google Play and Apple Store.

+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Eska
  • +
  • Onestein
  • +
+
+
+

Contributors

+ +
+
+

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.

+

This module is part of the OCA/server-brand project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/remove_odoo_enterprise/tests/__init__.py b/remove_odoo_enterprise/tests/__init__.py new file mode 100644 index 0000000..a60f353 --- /dev/null +++ b/remove_odoo_enterprise/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_remove_odoo_enterprise diff --git a/remove_odoo_enterprise/tests/test_remove_odoo_enterprise.py b/remove_odoo_enterprise/tests/test_remove_odoo_enterprise.py new file mode 100644 index 0000000..148ab59 --- /dev/null +++ b/remove_odoo_enterprise/tests/test_remove_odoo_enterprise.py @@ -0,0 +1,53 @@ +# Copyright 2020-2023 Onestein () +# Copyright 2020 Akretion () +# Copyright 2023 Le Filament (https://le-filament.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from lxml import etree + +from odoo.tests import common + + +class TestRemoveOdooEnterprise(common.TransactionCase): + def test_res_config_settings(self): + conf = self.env["res.config.settings"].create({}) + view = conf.get_views([[False, "form"]])["views"]["form"] + doc = etree.XML(view["arch"]) + + query = "//setting[field[@widget='upgrade_boolean']]" + for item in doc.xpath(query): + self.assertEqual(item.attrib["class"], "d-none") + + def test_search_base(self): + if self.env.get("payment.provider"): + acquirer_ids = self.env["payment.provider"].search([]) + self.assertFalse(any([a.module_to_buy for a in acquirer_ids])) + + def test_search_ir_module(self): + module_ids = self.env["ir.module.module"].search([]) + self.assertFalse(any([m.to_buy for m in module_ids])) + + def test_appstore_invisible(self): + """The appstore widget is invisible""" + conf = self.env["res.config.settings"].create({}) + view = conf.get_views([[False, "form"]])["views"]["form"] + doc = etree.XML(view["arch"]) + + query = "//widget[@name='mobile_apps_funnel']" + for item in doc.xpath(query): + self.assertTrue(item.attrib["invisible"]) + + def test_appstore_visible(self): + """Disabling the view makes the appstore widget visible again""" + conf_form_view = self.env.ref( + "remove_odoo_enterprise.res_config_settings_view_form" + ) + conf_form_view.active = False + conf = self.env["res.config.settings"].create({}) + view = conf.get_views([[False, "form"]])["views"]["form"] + doc = etree.XML(view["arch"]) + + query = "//widget[@name='mobile_apps_funnel']" + for item in doc.xpath(query): + self.assertNotIn("invisible", item.attrib) diff --git a/remove_odoo_enterprise/views/res_config_settings_views.xml b/remove_odoo_enterprise/views/res_config_settings_views.xml new file mode 100644 index 0000000..18e0c10 --- /dev/null +++ b/remove_odoo_enterprise/views/res_config_settings_views.xml @@ -0,0 +1,12 @@ + + + + res.config.settings + + + + 1 + + + +