[FIX] mail: adds shadow to RPCs

This commit adds shadow to RPCs that are not supposed to be blocking.

task-2352703

closes odoo/odoo#60017

X-original-commit: 4274a061ff1498f647580c38c7048da8a8cb0a9c
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Thanh Dodeur
2020-10-14 15:11:58 +00:00
parent c8ed4697f6
commit 840728b4dc
6 changed files with 11 additions and 11 deletions
@@ -147,7 +147,7 @@ function factory(dependencies) {
model: 'mail.activity',
method: 'activity_format',
args: [this.id],
}));
}, { shadow: true }));
this.update(this.constructor.convertData(data));
this.thread.refresh();
}
@@ -277,7 +277,7 @@ function factory(dependencies) {
model: 'mail.message',
method: 'message_format',
args: [[messageId]],
}));
}, { shadow: true }));
this.env.models['mail.message'].insert(Object.assign(
{},
this.env.models['mail.message'].convertData(messageData),
@@ -51,7 +51,7 @@ function factory(dependencies) {
const data = await this.async(() => this.env.services.rpc({
route: '/mail/init_messaging',
params: { context: context }
}));
}, { shadow: true }));
await this.async(() => this._init(data));
if (discuss.isOpen) {
discuss.openInitThread();
@@ -129,7 +129,7 @@ function factory(dependencies) {
kwargs: {
context: { active_test: false },
},
}));
}, { shadow: true }));
this.update({ hasCheckedUser: true });
if (userIds.length > 0) {
this.update({ user: [['insert', { id: userIds[0] }]] });
@@ -332,7 +332,7 @@ function factory(dependencies) {
model: 'mail.channel',
method: 'channel_info',
args: [ids],
});
}, { shadow: true });
const channels = this.env.models['mail.thread'].insert(
channelInfos.map(channelInfo => this.env.models['mail.thread'].convertData(channelInfo))
);
@@ -467,7 +467,7 @@ function factory(dependencies) {
model,
res_ids,
},
});
}, { shadow: true });
for (const id in data) {
const recipientInfoList = data[id].map(recipientInfoData => {
const [partner_id, emailInfo, reason] = recipientInfoData;
@@ -516,7 +516,7 @@ function factory(dependencies) {
],
fields: ['id', 'name', 'mimetype'],
orderBy: [{ name: 'id', asc: false }],
}));
}, { shadow: true }));
this.update({
originThreadAttachments: [['insert-and-replace',
attachmentsData.map(data =>
@@ -736,12 +736,12 @@ function factory(dependencies) {
model: this.model,
method: 'read',
args: [this.id, ['activity_ids']]
}));
}, { shadow: true }));
const activitiesData = await this.async(() => this.env.services.rpc({
model: 'mail.activity',
method: 'activity_format',
args: [newActivityIds]
}));
}, { shadow: true }));
const activities = this.env.models['mail.activity'].insert(activitiesData.map(
activityData => this.env.models['mail.activity'].convertData(activityData)
));
@@ -762,7 +762,7 @@ function factory(dependencies) {
res_id: this.id,
res_model: this.model,
},
}));
}, { shadow: true }));
if (followers.length > 0) {
this.update({
followers: [['insert-and-replace', followers.map(data =>
+1 -1
View File
@@ -67,7 +67,7 @@ function factory(dependencies) {
context,
fields,
},
});
}, { shadow: true });
return this.env.models['mail.user'].insert(usersData.map(userData =>
this.env.models['mail.user'].convertData(userData)
));