[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) <ltu@odoo.com>
This commit is contained in:
Xavier BOL (xbo)
2023-03-09 20:52:50 +01:00
committed by Xavier Bol (xbo)
co-authored by Laurent Stukkens
parent 7f4e274c03
commit 34ebf7f4cf
@@ -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();
}