diff --git a/README.md b/README.md
index 92b00d40238c..71e3e930ac44 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ addon | version | maintainers | summary
--- | --- | --- | ---
[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.0.1 |
| Add an option to change the chatter position
-[web_company_color](web_company_color/) | 18.0.1.0.6 | | Web Company Color
+[web_company_color](web_company_color/) | 18.0.1.0.7 | | 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 dd301cf9259f..60a91b70e7fb 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:8c4acd06346ec5b7687366b122ed8321c5312437d61d42ead690bd0308b2e82d
+ !! source digest: sha256:dae72dca32daa1de5666e39a00359088595ea0c6330b4b4300670e4e3a0b6680
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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 1c80998b4f3c..f5329cfa86d0 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.0.6",
+ "version": "18.0.1.0.7",
"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/i18n/ca.po b/web_company_color/i18n/ca.po
index 2f64a6b7d597..c36461d45121 100644
--- a/web_company_color/i18n/ca.po
+++ b/web_company_color/i18n/ca.po
@@ -85,6 +85,11 @@ msgstr ""
msgid "Navbar Background Color Hover"
msgstr ""
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/de.po b/web_company_color/i18n/de.po
index 4f2de1e13084..2dd74304a23b 100644
--- a/web_company_color/i18n/de.po
+++ b/web_company_color/i18n/de.po
@@ -89,6 +89,11 @@ msgstr "Navbar-Hintergrundfarbe"
msgid "Navbar Background Color Hover"
msgstr "Navbar Hintergrundfarbe Hover"
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/es.po b/web_company_color/i18n/es.po
index 6a77cc347908..bce719311df5 100644
--- a/web_company_color/i18n/es.po
+++ b/web_company_color/i18n/es.po
@@ -89,6 +89,11 @@ msgstr "Color de fondo de la barra de navegación"
msgid "Navbar Background Color Hover"
msgstr "Desplazamiento del color de fondo de la barra de navegación"
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/fr.po b/web_company_color/i18n/fr.po
index 353aa82db2d2..b2d9c4880af1 100644
--- a/web_company_color/i18n/fr.po
+++ b/web_company_color/i18n/fr.po
@@ -89,6 +89,11 @@ msgstr "Couleur de fond de la barre de navigation"
msgid "Navbar Background Color Hover"
msgstr "Couleur de fond de la barre de navigation (survol)"
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/hr.po b/web_company_color/i18n/hr.po
index ba43ab6ee956..216b13e7d62f 100644
--- a/web_company_color/i18n/hr.po
+++ b/web_company_color/i18n/hr.po
@@ -86,6 +86,11 @@ msgstr "Boja pozadine Navigacijske trake"
msgid "Navbar Background Color Hover"
msgstr "Poja pozadine navigacijske trake (hoover)"
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/it.po b/web_company_color/i18n/it.po
index 8ba2741fa715..1f22169ef9b7 100644
--- a/web_company_color/i18n/it.po
+++ b/web_company_color/i18n/it.po
@@ -88,6 +88,11 @@ msgstr "Sfondo Barra Navigazione"
msgid "Navbar Background Color Hover"
msgstr "Colore Hover Sfondo Barra Navigazione"
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/nl.po b/web_company_color/i18n/nl.po
index 854b597db379..dd38b466dd76 100644
--- a/web_company_color/i18n/nl.po
+++ b/web_company_color/i18n/nl.po
@@ -89,6 +89,11 @@ msgstr "Navigatiebalk Achtergrondkleur"
msgid "Navbar Background Color Hover"
msgstr "Navigatiebalk Achtergrondkleur (als je de muis er overheen beweegt)"
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/pt.po b/web_company_color/i18n/pt.po
index a707ece0a95c..02fb6798848a 100644
--- a/web_company_color/i18n/pt.po
+++ b/web_company_color/i18n/pt.po
@@ -88,6 +88,11 @@ msgstr "Cor de Fundo da Barra de Navegação"
msgid "Navbar Background Color Hover"
msgstr "Cor de Fundo da Barra de Navegação com Foco"
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/web_company_color.pot b/web_company_color/i18n/web_company_color.pot
index 0edc979260f1..f6430b4dffc1 100644
--- a/web_company_color/i18n/web_company_color.pot
+++ b/web_company_color/i18n/web_company_color.pot
@@ -81,6 +81,11 @@ msgstr ""
msgid "Navbar Background Color Hover"
msgstr ""
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/i18n/zh_CN.po b/web_company_color/i18n/zh_CN.po
index 1a1d86541cd0..586cdf9d68f1 100644
--- a/web_company_color/i18n/zh_CN.po
+++ b/web_company_color/i18n/zh_CN.po
@@ -85,6 +85,11 @@ msgstr "导航栏背景颜色"
msgid "Navbar Background Color Hover"
msgstr "导航栏鼠标悬停背景颜色"
+#. module: web_company_color
+#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_border_bottom
+msgid "Navbar Bottom Border Color"
+msgstr ""
+
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
diff --git a/web_company_color/models/res_company.py b/web_company_color/models/res_company.py
index 02a355ac5eb9..1e98afa97a5d 100644
--- a/web_company_color/models/res_company.py
+++ b/web_company_color/models/res_company.py
@@ -21,6 +21,7 @@ def _get_scss_template(self):
.o_main_navbar {
background: %(color_navbar_bg)s !important;
background-color: %(color_navbar_bg)s !important;
+ border-bottom: 1px solid %(color_navbar_border_bottom)s !important;
color: %(color_navbar_text)s !important;
.show {
@@ -109,6 +110,7 @@ def _get_scss_template(self):
&:hover, &:focus, &:active, &:focus:active {
background-color: %(color_navbar_bg_hover)s !important;
}
+ border-bottom: 1px solid %(color_navbar_border_bottom)s !important;
}
.o_menu_sections .dropdown-toggle {
background: %(color_navbar_bg)s !important;
@@ -117,6 +119,7 @@ def _get_scss_template(self):
&:hover, &:focus, &:active, &:focus:active {
background-color: %(color_navbar_bg_hover)s !important;
}
+ border-bottom: 1px solid %(color_navbar_border_bottom)s !important;
}
.o_menu_systray button,
.o_navbar_breadcrumbs,
@@ -137,6 +140,9 @@ def _get_scss_template(self):
color_navbar_bg_hover = fields.Char(
"Navbar Background Color Hover", sparse="company_colors"
)
+ color_navbar_border_bottom = fields.Char(
+ "Navbar Bottom Border Color", sparse="company_colors"
+ )
color_navbar_text = fields.Char("Navbar Text Color", sparse="company_colors")
color_button_text = fields.Char("Button Text Color", sparse="company_colors")
color_button_bg = fields.Char("Button Background Color", sparse="company_colors")
@@ -165,22 +171,15 @@ def unlink(self):
return super().unlink()
def write(self, values):
- if not self.env.context.get("ignore_company_color", False):
- fields_to_check = (
- "color_navbar_bg",
- "color_navbar_bg_hover",
- "color_navbar_text",
- "color_button_bg",
- "color_button_bg_hover",
- "color_button_text",
- "color_link_text",
- "color_link_text_hover",
- )
- result = super().write(values)
- if any([field in values for field in fields_to_check]):
+ result = super().write(values)
+ if not self.env.context.get("ignore_company_color"):
+ fields_to_check = ["company_colors"] + [
+ field_name
+ for field_name, field in self._fields.items()
+ if field.sparse == "company_colors"
+ ]
+ if any(field in values for field in fields_to_check):
self.scss_create_or_update_attachment()
- else:
- result = super().write(values)
return result
def button_compute_color(self):
@@ -201,10 +200,11 @@ def button_compute_color(self):
{
"color_navbar_bg": n_rgb_to_hex(_r, _g, _b),
"color_navbar_bg_hover": n_rgb_to_hex(_rd, _gd, _bd),
+ "color_navbar_border_bottom": n_rgb_to_hex(_rd, _gd, _bd),
"color_navbar_text": "#000" if _a < 0.5 else "#fff",
}
)
- self.write(values)
+ self.update(values)
def _scss_get_sanitized_values(self):
self.ensure_one()
@@ -216,6 +216,8 @@ def _scss_get_sanitized_values(self):
{
"color_navbar_bg": (values.get("color_navbar_bg") or "$o-brand-odoo"),
"color_navbar_bg_hover": (values.get("color_navbar_bg_hover")),
+ "color_navbar_border_bottom": values.get("color_navbar_border_bottom")
+ or f"darken({values.get('color_navbar_bg') or '$o-brand-odoo'}, 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")
diff --git a/web_company_color/static/description/index.html b/web_company_color/static/description/index.html
index 5b7a57114e3e..dd2882acf635 100644
--- a/web_company_color/static/description/index.html
+++ b/web_company_color/static/description/index.html
@@ -372,7 +372,7 @@
This module change navbar colors based in the company logo colors.
diff --git a/web_company_color/tests/test_res_company.py b/web_company_color/tests/test_res_company.py index 0121e9eeefe2..ea300cb38cb0 100644 --- a/web_company_color/tests/test_res_company.py +++ b/web_company_color/tests/test_res_company.py @@ -98,3 +98,26 @@ def test_compiled_scss(self): self.assertNotIn("desaturate", css) self.assertNotIn(color, css) self.assertIn(desaturated_color, css) + + def test_ignore_company_color(self): + """ + Test that we can turn off regenerating css attachment via context key + """ + company = self.env.company + attachment = self.env["ir.attachment"].search( + [("url", "=", company.scss_get_url())] + ) + attachment.unlink() + + company.company_colors = {} + attachment = self.env["ir.attachment"].search( + [("url", "=", company.scss_get_url())] + ) + self.assertTrue(attachment, "attachment should have been regenerated") + + attachment.unlink() + company.with_context(ignore_company_color=True).company_colors = {} + attachment = self.env["ir.attachment"].search( + [("url", "=", company.scss_get_url())] + ) + self.assertFalse(attachment, "attachment should not have been regenerated") diff --git a/web_company_color/view/res_company.xml b/web_company_color/view/res_company.xml index 45dd79421834..55969037919a 100644 --- a/web_company_color/view/res_company.xml +++ b/web_company_color/view/res_company.xml @@ -18,6 +18,7 @@