diff --git a/.copier-answers.yml b/.copier-answers.yml index 80cdbc8a5c2a..c087986c5865 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -17,7 +17,7 @@ odoo_version: 18.0 org_name: Odoo Community Association (OCA) org_slug: OCA rebel_module_groups: -- web_responsive +- web_responsive,web_responsive_company_color repo_description: web repo_name: web repo_slug: web diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6ccdbc5f9922..51cd677c0bdc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,17 +36,17 @@ jobs: matrix: include: - container: ghcr.io/oca/oca-ci/py3.10-odoo18.0:latest - include: "web_responsive" + include: "web_responsive,web_responsive_company_color" name: test with Odoo - container: ghcr.io/oca/oca-ci/py3.10-ocb18.0:latest - include: "web_responsive" + include: "web_responsive,web_responsive_company_color" name: test with OCB makepot: "true" - container: ghcr.io/oca/oca-ci/py3.10-odoo18.0:latest - exclude: "web_responsive" + exclude: "web_responsive,web_responsive_company_color" name: test with Odoo - container: ghcr.io/oca/oca-ci/py3.10-ocb18.0:latest - exclude: "web_responsive" + exclude: "web_responsive,web_responsive_company_color" name: test with OCB makepot: "true" services: diff --git a/README.md b/README.md index fb08ae68e94c..4b3068cf6cb7 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ addon | version | maintainers | summary [web_refresher](web_refresher/) | 18.0.1.0.1 | | Web Refresher [web_remember_tree_column_width](web_remember_tree_column_width/) | 18.0.1.0.2 | frahikLV luisg123v cuongnmtm | Remember the tree columns' widths across sessions. [web_responsive](web_responsive/) | 18.0.1.0.7 | Tardo SplashS | Responsive web client, community-supported +[web_responsive_company_color](web_responsive_company_color/) | 18.0.1.0.0 | | Styling hooks for web_responsive elements [web_save_discard_button](web_save_discard_button/) | 18.0.1.0.1 | synconics | Save & Discard Buttons [web_search_with_and](web_search_with_and/) | 18.0.1.0.1 | | Use AND conditions on omnibar search [web_send_message_popup](web_send_message_popup/) | 18.0.1.0.0 | | Web Send Message as Popup diff --git a/setup/_metapackage/pyproject.toml b/setup/_metapackage/pyproject.toml index 769f771bc756..405ae469d43e 100644 --- a/setup/_metapackage/pyproject.toml +++ b/setup/_metapackage/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "odoo-addons-oca-web" -version = "18.0.20260721.1" +version = "18.0.20260901.0" dependencies = [ "odoo-addon-web_action_conditionable==18.0.*", "odoo-addon-web_calendar_slot_duration==18.0.*", @@ -35,6 +35,7 @@ dependencies = [ "odoo-addon-web_refresher==18.0.*", "odoo-addon-web_remember_tree_column_width==18.0.*", "odoo-addon-web_responsive==18.0.*", + "odoo-addon-web_responsive_company_color==18.0.*", "odoo-addon-web_save_discard_button==18.0.*", "odoo-addon-web_search_with_and==18.0.*", "odoo-addon-web_send_message_popup==18.0.*", diff --git a/web_responsive_company_color/README.rst b/web_responsive_company_color/README.rst new file mode 100644 index 000000000000..a99dea7698ff --- /dev/null +++ b/web_responsive_company_color/README.rst @@ -0,0 +1,93 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +============================ +Web Responsive Company Color +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:1c7b508d406e3751ab0d89e6e2cd56c4f5d6a40d19b8aef5b51e575aa75b75fd + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/18.0/web_responsive_company_color + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_responsive_company_color + :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/web&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module bridges web_company_color with web_responsive. + +With this module, elements introduced or modified by web_responsive can +be styled with the same logic as web_company_color. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Simply install the app. See web_company_color for instructions on how to +customize colors. + +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 +------- + +* Anusri Veerappan Prakasam + +Contributors +------------ + +- `PyTech `__: + + - Alessandro Uffreduzzi + - Anusri Veerappan Prakasam + - Simone Rubino + +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/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_responsive_company_color/__init__.py b/web_responsive_company_color/__init__.py new file mode 100644 index 000000000000..1a9a001cf76a --- /dev/null +++ b/web_responsive_company_color/__init__.py @@ -0,0 +1,2 @@ +from . import models +from .hooks import post_init_hook, uninstall_hook diff --git a/web_responsive_company_color/__manifest__.py b/web_responsive_company_color/__manifest__.py new file mode 100644 index 000000000000..14a332741b74 --- /dev/null +++ b/web_responsive_company_color/__manifest__.py @@ -0,0 +1,18 @@ +{ + "name": "Web Responsive Company Color", + "summary": "Styling hooks for web_responsive elements", + "license": "AGPL-3", + "author": "Anusri Veerappan Prakasam, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "category": "Web", + "version": "18.0.1.0.0", + "depends": [ + "web_company_color", + "web_responsive", + ], + "data": [], + "post_init_hook": "post_init_hook", + "uninstall_hook": "uninstall_hook", + "installable": True, + "application": False, +} diff --git a/web_responsive_company_color/hooks.py b/web_responsive_company_color/hooks.py new file mode 100644 index 000000000000..d958c528a90f --- /dev/null +++ b/web_responsive_company_color/hooks.py @@ -0,0 +1,8 @@ +def uninstall_hook(env): + env["res.company"].with_context(uninstall_scss=True).search( + [] + ).scss_create_or_update_attachment() + + +def post_init_hook(env): + env["res.company"].search([]).scss_create_or_update_attachment() diff --git a/web_responsive_company_color/i18n/web_responsive_company_color.pot b/web_responsive_company_color/i18n/web_responsive_company_color.pot new file mode 100644 index 000000000000..699113fcdfd6 --- /dev/null +++ b/web_responsive_company_color/i18n/web_responsive_company_color.pot @@ -0,0 +1,19 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_responsive_company_color +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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: web_responsive_company_color +#: model:ir.model,name:web_responsive_company_color.model_res_company +msgid "Companies" +msgstr "" diff --git a/web_responsive_company_color/models/__init__.py b/web_responsive_company_color/models/__init__.py new file mode 100644 index 000000000000..aff44f335ae6 --- /dev/null +++ b/web_responsive_company_color/models/__init__.py @@ -0,0 +1 @@ +from . import res_company diff --git a/web_responsive_company_color/models/res_company.py b/web_responsive_company_color/models/res_company.py new file mode 100644 index 000000000000..c9c37b65e355 --- /dev/null +++ b/web_responsive_company_color/models/res_company.py @@ -0,0 +1,26 @@ +from odoo import models + + +class ResCompany(models.Model): + _inherit = "res.company" + + # For customizations of new web elements included + # under _get_scss_template to take effect, one need + # to handle migration to invoke post_init_hook() + def _get_scss_template(self): + uninstall_scss = self._context.get("uninstall_scss", False) + if not uninstall_scss: + return ( + super()._get_scss_template() + + """ +.app-menu-container { + background: url('/web_responsive/static/src/img/home-menu-bg-overlay.svg'), + linear-gradient( + to bottom, + %(color_navbar_bg)s, + desaturate(lighten(%(color_navbar_bg)s, 20%%), 15) + ); +} + """ + ) + return super()._get_scss_template() diff --git a/web_responsive_company_color/pyproject.toml b/web_responsive_company_color/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/web_responsive_company_color/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_responsive_company_color/readme/CONTRIBUTORS.md b/web_responsive_company_color/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..2453337cb575 --- /dev/null +++ b/web_responsive_company_color/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- [PyTech](https://www.pytech.it): + - Alessandro Uffreduzzi \ + - Anusri Veerappan Prakasam \ + - Simone Rubino \ diff --git a/web_responsive_company_color/readme/DESCRIPTION.md b/web_responsive_company_color/readme/DESCRIPTION.md new file mode 100644 index 000000000000..c7d4b2bd9dd8 --- /dev/null +++ b/web_responsive_company_color/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +This module bridges web_company_color with web_responsive. + +With this module, elements introduced or modified by web_responsive can +be styled with the same logic as web_company_color. diff --git a/web_responsive_company_color/readme/USAGE.md b/web_responsive_company_color/readme/USAGE.md new file mode 100644 index 000000000000..9ca0cdc8eee2 --- /dev/null +++ b/web_responsive_company_color/readme/USAGE.md @@ -0,0 +1,2 @@ +Simply install the app. See web_company_color for instructions on how to +customize colors. diff --git a/web_responsive_company_color/static/description/icon.png b/web_responsive_company_color/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/web_responsive_company_color/static/description/icon.png differ diff --git a/web_responsive_company_color/static/description/index.html b/web_responsive_company_color/static/description/index.html new file mode 100644 index 000000000000..fb4e68d3f039 --- /dev/null +++ b/web_responsive_company_color/static/description/index.html @@ -0,0 +1,442 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Web Responsive Company Color

+ +

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

+

This module bridges web_company_color with web_responsive.

+

With this module, elements introduced or modified by web_responsive can +be styled with the same logic as web_company_color.

+

Table of contents

+ +
+

Usage

+

Simply install the app. See web_company_color for instructions on how to +customize colors.

+
+
+

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

+
    +
  • Anusri Veerappan Prakasam
  • +
+
+
+

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/web project on GitHub.

+

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

+
+
+
+
+ + diff --git a/web_responsive_company_color/tests/__init__.py b/web_responsive_company_color/tests/__init__.py new file mode 100644 index 000000000000..c3b634b71adb --- /dev/null +++ b/web_responsive_company_color/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_res_company diff --git a/web_responsive_company_color/tests/test_res_company.py b/web_responsive_company_color/tests/test_res_company.py new file mode 100644 index 000000000000..4afb773cf443 --- /dev/null +++ b/web_responsive_company_color/tests/test_res_company.py @@ -0,0 +1,28 @@ +# Copyright 2025 Simone Rubino - PyTech +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import base64 + +from odoo.addons.base.tests.common import BaseCommon + + +class TestResCompany(BaseCommon): + def test_compiled_scss(self): + """The SCSS is compiled before being sent to the client.""" + # Arrange + company = self.env.company + color = "#d2e1dd" + result_color = "white" + company.color_navbar_bg = color + + # Act + company.scss_create_or_update_attachment() + + # Assert + attachment = self.env["ir.attachment"].search( + [("url", "=", company.scss_get_url())] + ) + css = base64.b64decode(attachment.datas).decode() + self.assertNotIn("desaturate(", css) + self.assertNotIn("lighten(", css) + self.assertIn(f"linear-gradient(to bottom, {color}, {result_color})", css)