diff --git a/addons/web/static/src/js/owl_compatibility.js b/addons/web/static/src/js/owl_compatibility.js index aa2d2e20751..bd46a23c8fe 100644 --- a/addons/web/static/src/js/owl_compatibility.js +++ b/addons/web/static/src/js/owl_compatibility.js @@ -375,6 +375,17 @@ odoo.define('web.OwlCompatibility', function () { */ on_attach_callback() { function recursiveCallMounted(component) { + if ( + component.__owl__.status !== 2 /* RENDERED */ && + component.__owl__.status !== 3 /* MOUNTED */ && + component.__owl__.status !== 4 /* UNMOUNTED */ + ) { + // Avoid calling mounted on a component that is not even + // rendered. Doing otherwise will lead to a crash if a + // specific mounted callback is legitimately relying on the + // component being mounted. + return; + } for (const key in component.__owl__.children) { recursiveCallMounted(component.__owl__.children[key]); }