[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) <aab@odoo.com>
This commit is contained in:
FrancoisGe
2022-11-21 15:57:05 +01:00
parent 1859860879
commit bfbe581d24
@@ -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