[FIX] mail: fix mocked attachment upload

The performFetch method has been rewritten in 14.5. Since then, we're relying
on the is_pending parameter given in the form data. This parameter is used as
if it was a boolean but is in fact a string representation of a boolean. This results
in incorrect  attachments since this parameter is used to determine both the
res_model and the res_id of the created attachment.

closes odoo/odoo#90330

X-original-commit: 743face4357403861423ba242fa2be8ac364c546
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
tsm-odoo
2022-05-03 03:57:15 +02:00
parent 241fa6c2b3
commit 59d4f45cee
@@ -67,7 +67,7 @@ MockServer.include({
async _performFetch(resource, init) {
if (resource === '/mail/attachment/upload') {
const ufile = init.body.get('ufile');
const is_pending = init.body.get('is_pending');
const is_pending = init.body.get('is_pending') === 'true';
const model = is_pending ? 'mail.compose.message' : init.body.get('thread_model');
const id = is_pending ? 0 : parseInt(init.body.get('thread_id'));
const attachmentId = this.mockCreate('ir.attachment', {