diff --git a/web_company_color/README.rst b/web_company_color/README.rst index 85b13a6445af..3d48b7295a1d 100644 --- a/web_company_color/README.rst +++ b/web_company_color/README.rst @@ -17,13 +17,13 @@ Web Company Color :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/16.0/web_company_color + :target: https://github.com/OCA/web/tree/17.0/web_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-16-0/web-16-0-web_company_color + :target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_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=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -38,14 +38,16 @@ This module change navbar colors based in the company logo colors. Usage ===== -Go to company record and set a logo. Can see/modify applied colors on the "Navbar" section. +Go to company record and set a logo. Can see/modify applied colors on +the "Navbar" section. For optimal results use images with alpha channel. Known issues / Roadmap ====================== -White color is omitted in the addition operation to support images without alpha channel. +White color is omitted in the addition operation to support images +without alpha channel. Bug Tracker =========== @@ -53,7 +55,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -61,27 +63,27 @@ Credits ======= Authors -~~~~~~~ +------- * Alexandre Díaz Contributors -~~~~~~~~~~~~ +------------ -* Jordi Ballester Alomar (ForgeFlow) -* Lois Rilo (ForgeFlow) -* Simone Orsi -* Iván Antón -* Bernat Puig (ForgeFlow) -* Dhara Solanki -* `Tecnativa `_: +- Jordi Ballester Alomar (ForgeFlow) +- Lois Rilo (ForgeFlow) +- Simone Orsi +- Iván Antón +- Bernat Puig (ForgeFlow) +- Dhara Solanki +- `Tecnativa `__: - * Jairo Llopis - * Alexandre Díaz - * Carlos Roca + - Jairo Llopis + - Alexandre Díaz + - Carlos Roca Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -93,6 +95,6 @@ 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. +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_company_color/__manifest__.py b/web_company_color/__manifest__.py index 9b50bee47119..5baf1058eda8 100644 --- a/web_company_color/__manifest__.py +++ b/web_company_color/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Web Company Color", "category": "web", - "version": "16.0.1.2.3", + "version": "17.0.1.0.0", "author": "Alexandre Díaz, Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", "depends": ["web", "base_sparse_field"], diff --git a/web_company_color/hooks.py b/web_company_color/hooks.py index ca23677bf0e6..04ac7f0b7dcb 100644 --- a/web_company_color/hooks.py +++ b/web_company_color/hooks.py @@ -1,15 +1,12 @@ # Copyright 2019 Alexandre Díaz # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import SUPERUSER_ID, api from .models.res_company import URL_BASE -def uninstall_hook(cr, registry): - env = api.Environment(cr, SUPERUSER_ID, {}) +def uninstall_hook(env): env["ir.attachment"].search([("url", "=like", "%s%%" % URL_BASE)]).unlink() -def post_init_hook(cr, registry): - env = api.Environment(cr, SUPERUSER_ID, {}) +def post_init_hook(env): env["res.company"].search([]).scss_create_or_update_attachment() diff --git a/web_company_color/models/assetsbundle.py b/web_company_color/models/assetsbundle.py index aec30736c652..c26e0e16f936 100644 --- a/web_company_color/models/assetsbundle.py +++ b/web_company_color/models/assetsbundle.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.http import request -from odoo.addons.base.models.assetsbundle import AssetsBundle, ScssStylesheetAsset +from odoo.addons.base.models.assetsbundle import AssetsBundle class AssetsBundleCompanyColor(AssetsBundle): @@ -17,6 +17,4 @@ def get_company_color_asset_node(self): company_id = ( self.env["res.company"].browse(active_company_id) or self.env.company ) - asset = ScssStylesheetAsset(self, url=company_id.scss_get_url()) - compiled = self.compile_css(asset.compile, asset.get_source()) - return "style", {}, compiled + return company_id.scss_get_url() diff --git a/web_company_color/models/ir_qweb.py b/web_company_color/models/ir_qweb.py index 944288c5080d..bcbeb68a4f8f 100644 --- a/web_company_color/models/ir_qweb.py +++ b/web_company_color/models/ir_qweb.py @@ -8,31 +8,26 @@ class QWeb(models.AbstractModel): _inherit = "ir.qweb" - def _generate_asset_nodes_cache( - self, - bundle, - css=True, - js=True, - debug=False, - async_load=False, - defer_load=False, - lazy_load=False, - media=None, + def _generate_asset_links_cache( + self, bundle, css=True, js=True, assets_params=None, rtl=False ): - res = super()._generate_asset_nodes( - bundle, css, js, debug, async_load, defer_load, lazy_load, media - ) + res = super()._generate_asset_links_cache(bundle, css, js, assets_params, rtl) if bundle == "web_company_color.company_color_assets": asset = AssetsBundleCompanyColor( - bundle, [], env=self.env, css=True, js=True + bundle, + [], + env=self.env, + css=True, + js=True, + debug_assets=False, + rtl=rtl, + assets_params=assets_params, ) res += [asset.get_company_color_asset_node()] return res - def _get_asset_content(self, bundle, defer_load=False, lazy_load=False, media=None): + def _get_asset_content(self, bundle, assets_params=None): """Handle 'special' web_company_color bundle""" if bundle == "web_company_color.company_color_assets": return [], [] - return super()._get_asset_content( - bundle, defer_load=defer_load, lazy_load=lazy_load, media=media - ) + return super()._get_asset_content(bundle, assets_params=assets_params) diff --git a/web_company_color/pyproject.toml b/web_company_color/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/web_company_color/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_company_color/readme/CONTRIBUTORS.md b/web_company_color/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..c66d22568de5 --- /dev/null +++ b/web_company_color/readme/CONTRIBUTORS.md @@ -0,0 +1,10 @@ +- Jordi Ballester Alomar \<\> (ForgeFlow) +- Lois Rilo \<\> (ForgeFlow) +- Simone Orsi \<\> +- Iván Antón \<\> +- Bernat Puig \<\> (ForgeFlow) +- Dhara Solanki \<\> +- [Tecnativa](https://www.tecnativa.com): + - Jairo Llopis + - Alexandre Díaz + - Carlos Roca diff --git a/web_company_color/readme/CONTRIBUTORS.rst b/web_company_color/readme/CONTRIBUTORS.rst deleted file mode 100644 index 180a4a029f3a..000000000000 --- a/web_company_color/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,11 +0,0 @@ -* Jordi Ballester Alomar (ForgeFlow) -* Lois Rilo (ForgeFlow) -* Simone Orsi -* Iván Antón -* Bernat Puig (ForgeFlow) -* Dhara Solanki -* `Tecnativa `_: - - * Jairo Llopis - * Alexandre Díaz - * Carlos Roca diff --git a/web_company_color/readme/DESCRIPTION.rst b/web_company_color/readme/DESCRIPTION.md similarity index 100% rename from web_company_color/readme/DESCRIPTION.rst rename to web_company_color/readme/DESCRIPTION.md diff --git a/web_company_color/readme/ROADMAP.rst b/web_company_color/readme/ROADMAP.md similarity index 71% rename from web_company_color/readme/ROADMAP.rst rename to web_company_color/readme/ROADMAP.md index 2b669379ae70..4fbb50e808d5 100644 --- a/web_company_color/readme/ROADMAP.rst +++ b/web_company_color/readme/ROADMAP.md @@ -1 +1,2 @@ -White color is omitted in the addition operation to support images without alpha channel. +White color is omitted in the addition operation to support images +without alpha channel. diff --git a/web_company_color/readme/USAGE.rst b/web_company_color/readme/USAGE.md similarity index 80% rename from web_company_color/readme/USAGE.rst rename to web_company_color/readme/USAGE.md index 0143fee7dbc9..9820c920f1c2 100644 --- a/web_company_color/readme/USAGE.rst +++ b/web_company_color/readme/USAGE.md @@ -1,3 +1,4 @@ -Go to company record and set a logo. Can see/modify applied colors on the "Navbar" section. +Go to company record and set a logo. Can see/modify applied colors on +the "Navbar" section. For optimal results use images with alpha channel. diff --git a/web_company_color/static/description/index.html b/web_company_color/static/description/index.html index d24839698c69..bac826421782 100644 --- a/web_company_color/static/description/index.html +++ b/web_company_color/static/description/index.html @@ -369,7 +369,7 @@

Web Company Color

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:8a814ac88491029ca65ef378be730bd05a762604c5913f24f9cf1c6ea5b160cb !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module change navbar colors based in the company logo colors.

Table of contents

@@ -387,19 +387,21 @@

Web Company Color

Usage

-

Go to company record and set a logo. Can see/modify applied colors on the “Navbar” section.

+

Go to company record and set a logo. Can see/modify applied colors on +the “Navbar” section.

For optimal results use images with alpha channel.

Known issues / Roadmap

-

White color is omitted in the addition operation to support images without alpha channel.

+

White color is omitted in the addition operation to support images +without alpha channel.

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.

+feedback.

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

@@ -436,7 +438,7 @@

Maintainers

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.

+

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_company_color/utils.py b/web_company_color/utils.py index 118ceb26a56e..2028a4c4b892 100644 --- a/web_company_color/utils.py +++ b/web_company_color/utils.py @@ -8,7 +8,7 @@ def n_rgb_to_hex(_r, _g, _b): - return "#{:02x}{:02x}{:02x}".format(int(255 * _r), int(255 * _g), int(255 * _b)) + return f"#{int(255 * _r):02x}{int(255 * _g):02x}{int(255 * _b):02x}" def convert_to_image(field_binary):