[FIX] web: ensure bound function is not undefined for "checkDefinitionWriteAccess"
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) <tde@openerp.com> Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
<PropertyValue
|
||||
id="domId"
|
||||
canChangeDefinition="state.canChangeDefinition"
|
||||
checkDefinitionWriteAccess.bind="checkDefinitionWriteAccess"
|
||||
checkDefinitionWriteAccess.bind="checkDefinitionWriteAccess ? checkDefinitionWriteAccess : () => {}"
|
||||
comodel="propertyConfiguration.comodel || ''"
|
||||
context="props.context"
|
||||
domain="propertyConfiguration.domain || '[]'"
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
tags="state.propertyDefinition.tags || []"
|
||||
readonly="props.readonly"
|
||||
canChangeTags="props.canChangeDefinition"
|
||||
checkDefinitionWriteAccess.bind="props.checkDefinitionWriteAccess"
|
||||
checkDefinitionWriteAccess.bind="props.checkDefinitionWriteAccess ? props.checkDefinitionWriteAccess : () => {}"
|
||||
deleteAction="'tags'"
|
||||
onTagsChange.bind="onTagsChange"/>
|
||||
</td>
|
||||
|
||||
@@ -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"/>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user