From cbdc1f8bcbbb6bb1710a90058bfdacaf5c2c448e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Fri, 21 Apr 2023 07:52:51 +0000 Subject: [PATCH] [FIX] web: ensure bound function is not undefined for "checkDefinitionWriteAccess" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the property field tag components and sub-components by ensuring that the ".bind" function of the component always receives a function. As the "checkDefinitionWriteAccess" prop is optional, it could crash because OWL would try to call ".bind" on an undefined function. The new code will pass an empty function instead as a fallback. (When it's not passed, it's never called, as it is in a display context and we do not create tags, e.g: when showing the tags in a kanban view). Task-3280847 closes odoo/odoo#119565 X-original-commit: 7d52600263bfd911156a2d94041fc522e2baff8a Signed-off-by: Thibault Delavallee (tde) Signed-off-by: Warnon Aurélien (awa) --- .../web/static/src/views/fields/properties/properties_field.xml | 2 +- .../static/src/views/fields/properties/property_definition.xml | 2 +- .../web/static/src/views/fields/properties/property_value.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/views/fields/properties/properties_field.xml b/addons/web/static/src/views/fields/properties/properties_field.xml index efa1333720f..73c6b103628 100644 --- a/addons/web/static/src/views/fields/properties/properties_field.xml +++ b/addons/web/static/src/views/fields/properties/properties_field.xml @@ -31,7 +31,7 @@ diff --git a/addons/web/static/src/views/fields/properties/property_value.xml b/addons/web/static/src/views/fields/properties/property_value.xml index fb3750079f4..374ff81f3b7 100644 --- a/addons/web/static/src/views/fields/properties/property_value.xml +++ b/addons/web/static/src/views/fields/properties/property_value.xml @@ -66,7 +66,7 @@ deleteAction="'value'" readonly="props.readonly" canChangeTags="props.canChangeDefinition" - checkDefinitionWriteAccess.bind="props.checkDefinitionWriteAccess" + checkDefinitionWriteAccess.bind="props.checkDefinitionWriteAccess ? props.checkDefinitionWriteAccess : () => {}" onValueChange.bind="onValueChange" onTagsChange.bind="props.onTagsChange"/>