From bfbe581d24c7c8a03ae6a5acf383d5fc1b89ccb5 Mon Sep 17 00:00:00 2001 From: FrancoisGe Date: Mon, 21 Nov 2022 08:57:01 +0000 Subject: [PATCH] [FIX] web: protect RPCs from component destruction In PR 102662, we added a protection to manage the call to RPC in the new form views when the component is destroyed. This fix did not exactly reproduce the behavior of V15 and the new relational model. The expected behavior of an RPC call when the component is destroyed is a promise never solved. This commit will therefore reintroduce this behavior. In web, it is impossible to test this behavior because no rpc is triggered when the view is destroyed. closes odoo/odoo#106171 X-original-commit: 207f26ace6732c33d7169102f2a5a9695f5dda99 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/views/basic_relational_model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/views/basic_relational_model.js b/addons/web/static/src/views/basic_relational_model.js index f2bd32513db..11a88ff8467 100644 --- a/addons/web/static/src/views/basic_relational_model.js +++ b/addons/web/static/src/views/basic_relational_model.js @@ -1337,7 +1337,7 @@ export class RelationalModel extends Model { args = args.concat(ev.target); if (owl.status(this.__component) === "destroyed") { console.warn("Component is destroyed"); - return payload.callback(Promise.resolve()); + return payload.callback(new Promise(() => {})); } const prom = new Promise((resolve, reject) => { owl.Component.env.session