From 34ebf7f4cfc6cc5ee66c3596e3850b4ac4c41c81 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Fri, 25 Nov 2022 12:52:08 +0000 Subject: [PATCH] [FIX] mail: use `relation` getter defined in parent component Before this commit, the relation is found in the fields of the record of the component but the relation could also be in the props of the component. This commit uses the getter `relation` defined in the parent component (Many2OneAvatarField) to search the relation in the props first and then in the fields of the record is the relation is not defined in the props. task-2702636 Part-of: odoo/odoo#108605 Co-authored-by: Laurent Stukkens (LTU) --- .../many2one_avatar_user_field/many2one_avatar_user_field.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/mail/static/src/views/fields/many2one_avatar_user_field/many2one_avatar_user_field.js b/addons/mail/static/src/views/fields/many2one_avatar_user_field/many2one_avatar_user_field.js index d3a97c08a93..b72c11953d3 100644 --- a/addons/mail/static/src/views/fields/many2one_avatar_user_field/many2one_avatar_user_field.js +++ b/addons/mail/static/src/views/fields/many2one_avatar_user_field/many2one_avatar_user_field.js @@ -16,8 +16,7 @@ export class Many2OneAvatarUserField extends Many2OneAvatarField { setup() { super.setup(); - const relation = this.props.record.fields[this.props.name].relation; - this.openChat = useOpenChat(relation); + this.openChat = useOpenChat(this.relation); if (this.props.withCommand) { useAssignUserCommand(); }