[FIX] mail: force the model when creating basic thread

fw of ca6cc05cec13f2e3f1d6555491c3180e9ff3ace2

closes odoo/odoo#60645

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Didier (did)
2020-10-23 15:34:07 +00:00
committed by Sébastien Theys
parent dd91d2a6c2
commit c9ff3672ca
2 changed files with 8 additions and 4 deletions
@@ -673,9 +673,11 @@ function factory(dependencies) {
this.update({
suggestedChannels: [[
'insert-and-replace',
mentions.map(data =>
this.env.models['mail.thread'].convertData(data))
]],
mentions.map(data => {
const threadData = this.env.models['mail.thread'].convertData(data);
return Object.assign({ model: 'mail.channel' }, threadData);
})
]],
});
if (this.suggestedChannels[0]) {
@@ -163,7 +163,9 @@ function factory(dependencies) {
// channels received at init.
convertedData.members = [['link', this.env.messaging.currentPartner]];
}
const channel = this.env.models['mail.thread'].insert(convertedData);
const channel = this.env.models['mail.thread'].insert(
Object.assign({ model: 'mail.channel' }, convertedData)
);
// flux specific: channels received at init have to be
// considered pinned. task-2284357
if (!channel.isPinned) {