From 47699f3e477157b7c49aff787bafdcf4d9e7f912 Mon Sep 17 00:00:00 2001 From: Lucas Perais Date: Wed, 22 Mar 2023 13:25:32 +0000 Subject: [PATCH] [REF] web: x2manyField: ensure we don't pass the props viewMode if not set Before this commit, we passed the viewMode props to the X2many field everytime. Since that props is optional, we don't have to pass it if it is not a string (null or undefined) This allows to display a field set as invisible in studio Part-of: odoo/odoo#115799 --- addons/web/static/src/views/fields/x2many/x2many_field.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/views/fields/x2many/x2many_field.js b/addons/web/static/src/views/fields/x2many/x2many_field.js index 9ff8e05ead1..529c3997dfa 100644 --- a/addons/web/static/src/views/fields/x2many/x2many_field.js +++ b/addons/web/static/src/views/fields/x2many/x2many_field.js @@ -43,7 +43,7 @@ export class X2ManyField extends Component { this.isMany2Many ); - this.archInfo = this.props.views[this.props.viewMode] || {}; + this.archInfo = this.props.views?.[this.props.viewMode] || {}; const { activeActions, creates } = this.archInfo; if (this.props.viewMode === "kanban") { @@ -277,11 +277,13 @@ export const x2ManyField = { addLabel: attrs["add-label"], context: dynamicInfo.context, domain: dynamicInfo.domain, - viewMode, - views, crudOptions: options, string, }; + if (viewMode) { + props.views = views; + props.viewMode = viewMode; + } if (widget) { props.widget = widget; }