From a6e7c41d5e1ae54550bbb10066a21474e79dc666 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Fri, 28 May 2021 10:03:28 +0000 Subject: [PATCH] [FIX] mail: fix className can be null in mixin Before this commit, the className can be null and then this processing: `this.className += ' o_clickable_m2x_avatar';` gives 'null o_clickable_m2x_avatar' in the class of the element classList. This commit checks if the className is not null if yes, then we add the the class otherwise the className is created in this mixins. closes odoo/odoo#71461 X-original-commit: d25459e6cbfc1dbe92350bc5b17bb33062ac4f12 Related: odoo/enterprise#18605 Signed-off-by: Aaron Bohy (aab) --- addons/mail/static/src/js/m2x_avatar_user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/m2x_avatar_user.js b/addons/mail/static/src/js/m2x_avatar_user.js index 76ec83c440f..0d3d4fa4496 100644 --- a/addons/mail/static/src/js/m2x_avatar_user.js +++ b/addons/mail/static/src/js/m2x_avatar_user.js @@ -29,7 +29,7 @@ const M2XAvatarMixin = { if (!this.supportedModels.includes(this.field.relation)) { throw new Error(`This widget is only supported on many2one and many2many fields pointing to ${JSON.stringify(this.supportedModels)}`); } - this.className += ' o_clickable_m2x_avatar'; + this.className = `${this.className || ''} o_clickable_m2x_avatar`.trim(); }, //--------------------------------------------------------------------------