OdooWiki OCA HUB

Apply Field Style

web_apply_field_style folder_open OCA/web open_in_new
web License: AGPL-3

Allow to set an additional css class to fields in form view.

Use case : you may highlight some fields for training purpose

auto_awesome What this module does

AI-generated from the code · Odoo 16.0

This module lets developers highlight specific fields on any Odoo form by adding CSS classes (like background colours) to them, useful for training or drawing attention to important fields.

This is a technical tool for Odoo developers rather than an end-user feature. It changes how form views are built: when Odoo loads a form, the module can automatically add extra style classes to chosen fields.

  • Developers define which fields get which style by extending a method on the base model and returning a dictionary that maps a model name to style classes and field names.
  • The module then modifies the form view definition so those fields carry the requested CSS class, for example a coloured background.
  • It validates the dictionary structure and raises a validation error if the expected format is not respected, helping developers catch mistakes early.
  • It only acts on form views; other view types are left untouched.

There are no menus, buttons, reports or scheduled actions added. The demo code shows an example where, under a specific context, fields on the user form such as login, type and partner_id receive background styles. In short, it is a developer-facing customisation hook, not a business feature.

Depends on

base
Models and fields (1)
  • base · extends an existing model

Text generated by AI (DeepSeek) from reading the Odoo 16.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 1 confirmed, 8 with no information of 9 versions.

terminal Installation and usage

OCA documentation · Odoo 16.0

Override _get_field_styles() with a dict of fields list per model

class Base(models.AbstractModel):
    _inherit = "base"

    def _get_field_styles(self):
        res = super()._get_field_styles()
        res["product.product"] = {
            "my-css-class1": ["field1", "field2"],
            "my-css-class2": ["field3"],
        }
        return res

No verified information in OCA: Installation, Usage.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.