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
128 changes: 128 additions & 0 deletions web_company_context_highlight/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=============================
Web Company Context Highlight
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:38a53b982d2d8c282f7bee4b39e8df7f2324ab0ef62629ea37a4baa6d9ee457f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/19.0/web_company_context_highlight
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_company_context_highlight
: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=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module highlights the company switcher in the top bar of the web
client when multiple companies are selected.

In a multi-company Odoo environment, users can easily lose track of
their active company context. When more than one company is selected,
they might unintentionally create or view records in the wrong context.

By applying a visual highlight to the company switcher when multiple
companies are selected, this module provides an immediate visual cue,
helping users remain aware of their active companies and reducing the
risk of data entry errors.

- with multiple companies selected

|company switcher with multiple companies selected|

- with one company selected

|company switcher with one company selected|

.. |company switcher with multiple companies selected| image:: https://raw.githubusercontent.com/OCA/web/19.0/web_company_context_highlight/static/img/web_company_context_highlight_multiple_companies_selected.png
.. |company switcher with one company selected| image:: https://raw.githubusercontent.com/OCA/web/19.0/web_company_context_highlight/static/img/web_company_context_highlight_one_company_selected.png

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure the highlight colors:

1. Go to **Settings** > **General Settings**.
2. Scroll to the **Companies** section.
3. Under **Company Switcher Highlight**, set the desired **Background
Color** and **Text Color** using the color pickers.
4. Click **Save**.

|color configuration|

Alternatively, you can configure these values by modifying the following
System Parameters (in debug mode, under **Settings** > **Technical** >
**System Parameters**):

- ``web_company_context_highlight.color``: The background color code
(default: ``#ffc107``).
- ``web_company_context_highlight.text_color``: The text color code
(default: ``#212529``).

.. |color configuration| image:: https://raw.githubusercontent.com/OCA/web/19.0/web_company_context_highlight/static/img/web_company_context_highlight_config_color.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/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 <https://github.com/OCA/web/issues/new?body=module:%20web_company_context_highlight%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Acsone

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-pverkest| image:: https://github.com/pverkest.png?size=40px
:target: https://github.com/pverkest
:alt: pverkest

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-pverkest|

This module is part of the `OCA/web <https://github.com/OCA/web/tree/19.0/web_company_context_highlight>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions web_company_context_highlight/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import models
26 changes: 26 additions & 0 deletions web_company_context_highlight/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2026 Acsone
# @author Pierre Verkest <pierre.verkest@apycod.fr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Web Company Context Highlight",
"summary": "Highlight the company switcher when multiple companies are selected",
"version": "19.0.1.0.0",
"author": "Acsone, Odoo Community Association (OCA)",
"maintainers": ["pverkest"],
"website": "https://github.com/OCA/web",
"license": "LGPL-3",
"category": "Web",
"depends": ["web", "base_setup"],
"data": ["views/res_config_settings_views.xml"],
"assets": {
"web.assets_backend": [
"web_company_context_highlight/static/src/**/*.js",
"web_company_context_highlight/static/src/**/*.scss",
"web_company_context_highlight/static/src/**/*.xml",
],
"web.assets_tests": [
"web_company_context_highlight/static/tests/tours/**/*.js",
],
},
}
4 changes: 4 additions & 0 deletions web_company_context_highlight/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import ir_http
from . import res_config_settings
25 changes: 25 additions & 0 deletions web_company_context_highlight/models/ir_http.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2026 Acsone
# @author Pierre Verkest <pierre.verkest@apycod.fr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import models


class IrHttp(models.AbstractModel):
_inherit = "ir.http"

def session_info(self):
session = super().session_info()
highlight_color = (
self.env["ir.config_parameter"]
.sudo()
.get_param("web_company_context_highlight.color", "#ffc107")
)
text_color = (
self.env["ir.config_parameter"]
.sudo()
.get_param("web_company_context_highlight.text_color", "#212529")
)
session["web_company_context_highlight_color"] = highlight_color
session["web_company_context_highlight_text_color"] = text_color
return session
24 changes: 24 additions & 0 deletions web_company_context_highlight/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2026 Acsone
# @author Pierre Verkest <pierre.verkest@apycod.fr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

web_company_context_highlight_color = fields.Char(
string="Company Highlight Color",
default="#ffc107",
config_parameter="web_company_context_highlight.color",
help="Background color used to highlight the company switcher "
"when in multi-company context.",
)
web_company_context_highlight_text_color = fields.Char(
string="Company Highlight Text Color",
default="#212529",
config_parameter="web_company_context_highlight.text_color",
help="Text color used to highlight the company switcher "
"when in multi-company context.",
)
3 changes: 3 additions & 0 deletions web_company_context_highlight/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
13 changes: 13 additions & 0 deletions web_company_context_highlight/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
To configure the highlight colors:

1. Go to **Settings** > **General Settings**.
2. Scroll to the **Companies** section.
3. Under **Company Switcher Highlight**, set the desired **Background Color** and **Text Color** using the color pickers.
4. Click **Save**.

![color configuration](../static/img/web_company_context_highlight_config_color.png)

Alternatively, you can configure these values by modifying the following System Parameters (in debug mode, under **Settings** > **Technical** > **System Parameters**):

* `web_company_context_highlight.color`: The background color code (default: `#ffc107`).
* `web_company_context_highlight.text_color`: The text color code (default: `#212529`).
13 changes: 13 additions & 0 deletions web_company_context_highlight/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This module highlights the company switcher in the top bar of the web client when multiple companies are selected.

In a multi-company Odoo environment, users can easily lose track of their active company context. When more than one company is selected, they might unintentionally create or view records in the wrong context.

By applying a visual highlight to the company switcher when multiple companies are selected, this module provides an immediate visual cue, helping users remain aware of their active companies and reducing the risk of data entry errors.

* with multiple companies selected

![company switcher with multiple companies selected](../static/img/web_company_context_highlight_multiple_companies_selected.png)

* with one company selected

![company switcher with one company selected](../static/img/web_company_context_highlight_one_company_selected.png)
Loading
Loading