Skip to content
Open
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
10 changes: 10 additions & 0 deletions web_company_color/i18n/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,21 @@ msgstr ""
msgid "Company Styles"
msgstr ""

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "Esteu segur que voleu restablir tots els colors als valors predeterminats d'Odoo?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr ""

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "Restableix els colors"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,21 @@ msgstr "Unternehmensfarben"
msgid "Company Styles"
msgstr "Unternehmensstile"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "Sind Sie sicher, dass Sie alle Farben auf die Odoo-Standardwerte zurücksetzen möchten?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr "Farben aus Logo generieren"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "Farben zurücksetzen"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,21 @@ msgstr "Colores de la compañía"
msgid "Company Styles"
msgstr "Estilos de compañía"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "¿Está seguro de que desea restablecer todos los colores a los valores predeterminados de Odoo?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr "Calcular colores a partir del logo"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "Restablecer colores"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,21 @@ msgstr "Couleurs de la société"
msgid "Company Styles"
msgstr "Styles de la société"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "Êtes-vous sûr de vouloir réinitialiser toutes les couleurs aux valeurs par défaut d'Odoo ?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr "Déterminer les couleurs à partir du logo"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "Réinitialiser les couleurs"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/hr.po
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,21 @@ msgstr "Boje tvrtke"
msgid "Company Styles"
msgstr "Stilovi tvrtke"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "Jeste li sigurni da želite poništiti sve boje na Odoo zadane vrijednosti?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr ""

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "Poništi boje"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,21 @@ msgstr "Colori Aziendali"
msgid "Company Styles"
msgstr "Stili Aziendali"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "Si è sicuri di voler reimpostare tutti i colori ai valori predefiniti di Odoo?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr "Calcola colori dal logo"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "Reimposta colori"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,21 @@ msgstr "Bedrijfskleuren"
msgid "Company Styles"
msgstr "Bedrijfsstijlen"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "Weet u zeker dat u alle kleuren wilt terugzetten naar de Odoo-standaardwaarden?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr "Genereer kleuren vanuit het logo"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "Kleuren herstellen"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,21 @@ msgstr "Cores da Empresa"
msgid "Company Styles"
msgstr "Estilos da Empresa"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "Tem a certeza de que pretende repor todas as cores para os valores predefinidos do Odoo?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr "Calcular cores a partir do logotipo"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "Repor cores"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/web_company_color.pot
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,21 @@ msgstr ""
msgid "Company Styles"
msgstr ""

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr ""

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr ""

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr ""

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
10 changes: 10 additions & 0 deletions web_company_color/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,21 @@ msgstr "公司颜色"
msgid "Company Styles"
msgstr "公司风格"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Are you sure you want to reset all colors to Odoo defaults?"
msgstr "您确定要将所有颜色重置为Odoo默认值吗?"

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr ""

#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Reset colors"
msgstr "重置颜色"

#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def unlink(self):
def write(self, values):
if not self.env.context.get("ignore_company_color", False):
fields_to_check = (
"company_colors",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, I had already my changes from #3484 in mind when suggesting my change. Those two PRs will conflict now, if you could review that one to get it merged, you can rebase your code and remove this part

"color_navbar_bg",
"color_navbar_bg_hover",
"color_navbar_text",
Expand All @@ -183,6 +184,10 @@ def write(self, values):
result = super().write(values)
return result

def button_reset_colors(self):
self.ensure_one()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need this, please remove

self.write({"company_colors": {}})

def button_compute_color(self):
self.ensure_one()
values = self.default_get(
Expand Down
45 changes: 45 additions & 0 deletions web_company_color/tests/test_res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,51 @@ def test_change_color(self):
"Invalid Navbar Background Color",
)

def test_reset_colors(self):
company = self.env["res.company"].search([], limit=1)
company.sudo().write(
{
"color_navbar_bg": "#111111",
"color_navbar_bg_hover": "#222222",
"color_navbar_text": "#333333",
"color_button_bg": "#444444",
"color_button_bg_hover": "#555555",
"color_button_text": "#666666",
"color_link_text": "#777777",
"color_link_text_hover": "#888888",
"color_submenu_text": "#999999",
}
)
company.button_reset_colors()
company.invalidate_recordset()
self.assertEqual(
company.company_colors, {}, "company_colors should be empty after reset"
)
self.assertFalse(company.color_navbar_bg, "color_navbar_bg should be reset")
self.assertFalse(
company.color_navbar_bg_hover, "color_navbar_bg_hover should be reset"
)
self.assertFalse(company.color_navbar_text, "color_navbar_text should be reset")
self.assertFalse(company.color_button_bg, "color_button_bg should be reset")
self.assertFalse(
company.color_button_bg_hover, "color_button_bg_hover should be reset"
)
self.assertFalse(company.color_button_text, "color_button_text should be reset")
self.assertFalse(company.color_link_text, "color_link_text should be reset")
self.assertFalse(
company.color_link_text_hover, "color_link_text_hover should be reset"
)
self.assertFalse(
company.color_submenu_text, "color_submenu_text should be reset"
)
attachment = self.env["ir.attachment"].search(
[("url", "=", company.scss_get_url())]
)
css = base64.b64decode(attachment.datas).decode()
self.assertNotIn(
"#111111", css, "SCSS should not contain old colors after reset"
)

def test_compiled_scss(self):
"""The SCSS is compiled before being sent to the client."""
# Arrange
Expand Down
7 changes: 7 additions & 0 deletions web_company_color/view/res_company.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
type="object"
string="Compute colors from logo"
/>
<button
class="btn-secondary ms-2"
name="button_reset_colors"
type="object"
string="Reset colors"
confirm="Are you sure you want to reset all colors to Odoo defaults?"
/>
<div
class="alert alert-info info_icon mt-2 d-flex align-items-center"
role="alert"
Expand Down
Loading