Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ addon | version | maintainers | summary
--- | --- | --- | ---
[web_calendar_slot_duration](web_calendar_slot_duration/) | 18.0.1.0.0 | <a href='https://github.com/Yajo'><img src='https://github.com/Yajo.png' width='32' height='32' style='border-radius:50%;' alt='Yajo'/></a> | Customizable calendar slot durations
[web_chatter_position](web_chatter_position/) | 18.0.1.0.1 | <a href='https://github.com/trisdoan'><img src='https://github.com/trisdoan.png' width='32' height='32' style='border-radius:50%;' alt='trisdoan'/></a> | 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 | <a href='https://github.com/grindtildeath'><img src='https://github.com/grindtildeath.png' width='32' height='32' style='border-radius:50%;' alt='grindtildeath'/></a> | Allows to define a default time on datetime picker
Expand Down
2 changes: 1 addition & 1 deletion web_company_color/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion web_company_color/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/hr.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/web_company_color.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
34 changes: 18 additions & 16 deletions web_company_color/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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")
Expand Down Expand Up @@ -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):
Expand All @@ -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()
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion web_company_color/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ <h1>Web Company Color</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8c4acd06346ec5b7687366b122ed8321c5312437d61d42ead690bd0308b2e82d
!! source digest: sha256:dae72dca32daa1de5666e39a00359088595ea0c6330b4b4300670e4e3a0b6680
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/18.0/web_company_color"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_company_color"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module change navbar colors based in the company logo colors.</p>
Expand Down
23 changes: 23 additions & 0 deletions web_company_color/tests/test_res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
1 change: 1 addition & 0 deletions web_company_color/view/res_company.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<group string="Colors" name="navbar_colors">
<field name="color_navbar_bg" widget="color" />
<field name="color_navbar_bg_hover" widget="color" />
<field name="color_navbar_border_bottom" widget="color" />
<field name="color_navbar_text" widget="color" />
<field name="color_button_bg" widget="color" />
<field name="color_button_bg_hover" widget="color" />
Expand Down
Loading
Loading