From 59d4f45cee7d775758d2c0f099fd604c75e626e2 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Mon, 2 May 2022 09:08:35 +0000 Subject: [PATCH] [FIX] mail: fix mocked attachment upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/mail/static/tests/helpers/mock_server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/tests/helpers/mock_server.js b/addons/mail/static/tests/helpers/mock_server.js index 4ad066ba732..9f49d6c24df 100644 --- a/addons/mail/static/tests/helpers/mock_server.js +++ b/addons/mail/static/tests/helpers/mock_server.js @@ -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', {