From 8b54b08c26f81fa6b685637ed2a4120c3aadeecc Mon Sep 17 00:00:00 2001 From: std-odoo Date: Mon, 5 Jun 2023 06:02:01 +0000 Subject: [PATCH] [FIX] web: properties, fix the label requirement check Bug === The labels of the properties and their names are always required, the check was wrongly done and still used the historical name "id" instead of "name". If a property value is missing, the color of the label is marked in red. But the datepicker and dropdown are also in read which we don't want (only the label). Task-3188915 closes odoo/odoo#133479 X-original-commit: 5c0720743d299eec305a025d20201103f9f45dc5 Signed-off-by: Thibault Delavallee (tde) --- .../static/src/model/relational_model/record.js | 16 ++++++++++++++++ .../fields/properties/properties_field.scss | 1 + 2 files changed, 17 insertions(+) diff --git a/addons/web/static/src/model/relational_model/record.js b/addons/web/static/src/model/relational_model/record.js index 450ac218a06..91d55294904 100644 --- a/addons/web/static/src/model/relational_model/record.js +++ b/addons/web/static/src/model/relational_model/record.js @@ -331,6 +331,22 @@ export class Record extends DataPoint { } break; } + case "properties": { + const value = this.data[fieldName]; + if (value) { + const ok = value.every( + (propertyDefinition) => + propertyDefinition.name && + propertyDefinition.name.length && + propertyDefinition.string && + propertyDefinition.string.length + ); + if (!ok) { + unsetRequiredFields.push(fieldName); + } + } + break; + } default: if (!this.data[fieldName] && this._isRequired(fieldName)) { unsetRequiredFields.push(fieldName); diff --git a/addons/web/static/src/views/fields/properties/properties_field.scss b/addons/web/static/src/views/fields/properties/properties_field.scss index 146ff82204b..77ed18a8bad 100644 --- a/addons/web/static/src/views/fields/properties/properties_field.scss +++ b/addons/web/static/src/views/fields/properties/properties_field.scss @@ -15,6 +15,7 @@ .o_dropdown_button, .o_datepicker_button { @include print-variable(o-input-border-color, $o-form-lightsecondary); + color: $o-main-text-color !important; } .o_dropdown_button, .o_datepicker_button {