diff --git a/README.md b/README.md
index 872673c966fb..bd93abf7e487 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ addon | version | maintainers | summary
[web_action_conditionable](web_action_conditionable/) | 18.0.1.0.0 | | web_action_conditionable
[web_calendar_slot_duration](web_calendar_slot_duration/) | 18.0.1.0.0 |
| Customizable calendar slot durations
[web_chatter_position](web_chatter_position/) | 18.0.1.1.1 |
| Add an option to change the chatter position
-[web_company_color](web_company_color/) | 18.0.1.1.0 | | Web Company Color
+[web_company_color](web_company_color/) | 18.0.1.1.1 | | Web Company Color
[web_copy_confirm](web_copy_confirm/) | 18.0.1.0.0 | | Show confirmation dialogue before copying records
[web_dark_mode](web_dark_mode/) | 18.0.1.0.0 | | Enabled Dark Mode for the Odoo Backend
[web_datetime_picker_default_time](web_datetime_picker_default_time/) | 18.0.1.0.0 |
| Allows to define a default time on datetime picker
diff --git a/web_company_color/README.rst b/web_company_color/README.rst
index e3f14499b0b8..e790c327dcf3 100644
--- a/web_company_color/README.rst
+++ b/web_company_color/README.rst
@@ -11,7 +11,7 @@ Web Company Color
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:3e5f3c3f38a73bd62888ddabe88246540e60d039a5ae554d85784cb1ce1623d3
+ !! source digest: sha256:34edb79a4d37371edb0fb274655e023771086ac8fbcf3bc29b82ca12eb748c08
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
diff --git a/web_company_color/__manifest__.py b/web_company_color/__manifest__.py
index 1f30c4e8af32..1a2280bed998 100644
--- a/web_company_color/__manifest__.py
+++ b/web_company_color/__manifest__.py
@@ -5,7 +5,7 @@
{
"name": "Web Company Color",
"category": "web",
- "version": "18.0.1.1.0",
+ "version": "18.0.1.1.1",
"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/models/ir_qweb.py b/web_company_color/models/ir_qweb.py
index b9f389f004e3..bee28e831685 100644
--- a/web_company_color/models/ir_qweb.py
+++ b/web_company_color/models/ir_qweb.py
@@ -8,50 +8,20 @@
class QWeb(models.AbstractModel):
_inherit = "ir.qweb"
- def _generate_asset_links_cache(
- self,
- bundle,
- css=True,
- js=True,
- assets_params=None,
- rtl=False,
- ):
- res = super()._generate_asset_links_cache(
- bundle,
- css=css,
- js=js,
- assets_params=assets_params,
- rtl=rtl,
- )
- if bundle == "web_company_color.company_color_assets":
- asset = AssetsBundleCompanyColor(
- bundle, [], env=self.env, css=True, js=True
- )
- res += [asset.get_company_color_asset_node()]
- return res
+ def _get_asset_links(self, bundle, css=True, js=True, debug=None):
+ """Inject the active company scss.
- def _generate_asset_links(
- self,
- bundle,
- css=True,
- js=True,
- debug_assets=False,
- assets_params=None,
- rtl=False,
- ):
- res = super()._generate_asset_links(
- bundle,
- css=css,
- js=js,
- debug_assets=debug_assets,
- assets_params=assets_params,
- rtl=rtl,
- )
+ This must be done outside of the cached methods
+ (``_generate_asset_links_cache``), because their cache key does not
+ depend on the company and the cached list is shared by all requests.
+ """
+ res = super()._get_asset_links(bundle, css=css, js=js, debug=debug)
if bundle == "web_company_color.company_color_assets":
asset = AssetsBundleCompanyColor(
bundle, [], env=self.env, css=True, js=True
)
- res += [asset.get_company_color_asset_node()]
+ # Build a new list to not alter the (possibly cached) one
+ res = res + [asset.get_company_color_asset_node()]
return res
def _get_asset_content(self, bundle, assets_params=None):
diff --git a/web_company_color/models/res_company.py b/web_company_color/models/res_company.py
index 3d40723bc5e4..2276b5ab8a93 100644
--- a/web_company_color/models/res_company.py
+++ b/web_company_color/models/res_company.py
@@ -29,41 +29,23 @@ def _get_scss_template(self):
background-color: %(color_navbar_bg_hover)s !important;
}
}
-
- > ul {
- > li {
- > a, > label {
- color: %(color_navbar_text)s !important;
-
- &:hover, &:focus, &:active, &:focus:active {
- background-color: %(color_navbar_bg_hover)s !important;
- }
- }
- }
- }
}
- .o_menu_brand {
+ .o_main_navbar .o_menu_brand {
+ color: rgba(%(color_navbar_text)s, 0.9) !important;
+ &:hover, &:focus, &:active, &:focus:active {
+ background: none !important;
color: %(color_navbar_text)s !important;
- &:hover, &:focus, &:active, &:focus:active {
- background-color: %(color_navbar_bg_hover)s !important;
- }
- }
-
- a[href],
- a[tabindex],
- .btn-link,
- .o_external_button {
- color: %(color_link_text)s;
- .o_main_navbar {
- color: none;
- }
}
+ }
+ a[href],
+ a[tabindex],
+ .btn-link,
+ .o_external_button {
+ color: %(color_link_text)s;
+ }
a:hover,
.btn-link:hover {
color: %(color_link_text_hover)s;
- .o_main_navbar {
- color: none;
- }
}
.btn-primary:not(.disabled),
.ui-autocomplete .ui-menu-item > a.ui-state-active {
@@ -89,12 +71,12 @@ def _get_scss_template(self):
.o_form_view .oe_button_box .oe_stat_button > span .o_stat_value {
color: %(color_link_text)s !important;
}
- .o_form_view .o_form_statusbar > .o_statusbar_status >
- .o_arrow_button.btn-primary.disabled {
+ .o_form_view .o_form_statusbar .o_statusbar_status
+ .o_arrow_button.o_arrow_button_current {
color: %(color_link_text)s !important;
}
.o_required_modifier{
- :focus-within {
+ &:focus-within {
--o-input-border-color: %(color_button_bg)s !important;
--o-caret-color: %(color_button_bg)s !important;
}
@@ -184,6 +166,8 @@ def write(self, values):
def button_reset_colors(self):
self.write({"company_colors": {}})
+ # Reload like a regular save does, so the reset colors are applied
+ return {"type": "ir.actions.client", "tag": "reload_context"}
def button_compute_color(self):
self.ensure_one()
@@ -215,12 +199,16 @@ def _scss_get_sanitized_values(self):
# This allow extend company_colors and only sanitize selected fields
# or add custom values
values = dict(self.company_colors or {})
+ # The SCSS is compiled alone, so Odoo SCSS variables
+ # (like $o-brand-odoo) are not available: use literal colors.
+ navbar_bg = values.get("color_navbar_bg") or "#71639e"
values.update(
{
- "color_navbar_bg": (values.get("color_navbar_bg") or "$o-brand-odoo"),
- "color_navbar_bg_hover": (values.get("color_navbar_bg_hover")),
+ "color_navbar_bg": navbar_bg,
+ "color_navbar_bg_hover": values.get("color_navbar_bg_hover")
+ or f"darken({navbar_bg}, 10%)",
"color_navbar_border_bottom": values.get("color_navbar_border_bottom")
- or f"darken({values.get('color_navbar_bg') or '$o-brand-odoo'}, 10%)",
+ or f"darken({navbar_bg}, 10%)",
"color_navbar_text": (values.get("color_navbar_text") or "#FFF"),
"color_button_bg": values.get("color_button_bg") or "#71639e",
"color_button_bg_hover": values.get("color_button_bg_hover")
@@ -229,7 +217,7 @@ def _scss_get_sanitized_values(self):
"color_link_text": values.get("color_link_text") or "#71639e",
"color_link_text_hover": values.get("color_link_text_hover")
or "darken(#71639e, 10%)",
- "color_submenu_text": values.get("color_link_text") or "#374151",
+ "color_submenu_text": values.get("color_submenu_text") or "#374151",
}
)
return values
diff --git a/web_company_color/static/description/index.html b/web_company_color/static/description/index.html
index f0150e75f03e..6d672e3b199a 100644
--- a/web_company_color/static/description/index.html
+++ b/web_company_color/static/description/index.html
@@ -3,7 +3,7 @@