From 699994fccf5580cf0c68ab50d5568967f3df4b8a Mon Sep 17 00:00:00 2001 From: William Braeckman Date: Tue, 20 Sep 2022 11:41:44 +0000 Subject: [PATCH] [IMP] web: make it possible to add classes to fields `additionalClasses` can now be set on field components to add certain classes the wrapper should have. This is useful in case css rules have been defined on a field widget that we want to inherit from. X-original-commit: e882c892ad2bf476a6d25cbd90e72974c5453a38 Part-of: odoo/odoo#100764 --- addons/web/static/src/views/fields/field.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/web/static/src/views/fields/field.js b/addons/web/static/src/views/fields/field.js index dce0dbb9393..35a5ae7d361 100644 --- a/addons/web/static/src/views/fields/field.js +++ b/addons/web/static/src/views/fields/field.js @@ -99,6 +99,11 @@ export class Field extends Component { [`o_field_${this.type}`]: true, [_class]: Boolean(_class), }; + if (this.FieldComponent.additionalClasses) { + for (const cls of this.FieldComponent.additionalClasses) { + classNames[cls] = true; + } + } // generate field decorations classNames (only if field-specific decorations // have been defined in an attribute, e.g. decoration-danger="other_field = 5")