diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index 2c633f76f3d..38643f7bf7b 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -111,7 +111,6 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/clipboard/clipboard.js', 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/lib/qweb/qweb2.js', - 'web/static/src/legacy/js/assets.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', 'web/static/src/legacy/js/libs/content-disposition.js', @@ -309,7 +308,6 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/clipboard/clipboard.js', 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/lib/qweb/qweb2.js', - 'web/static/src/legacy/js/assets.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', 'web/static/src/legacy/js/libs/content-disposition.js', diff --git a/addons/web/static/src/core/assets.js b/addons/web/static/src/core/assets.js index e149acdd51c..27aff25c951 100644 --- a/addons/web/static/src/core/assets.js +++ b/addons/web/static/src/core/assets.js @@ -69,9 +69,16 @@ export const _loadCSS = (assets.loadCSS = memoize(function loadCSS(url, retryCou linkEl.addEventListener("load", () => resolve(true)); linkEl.addEventListener("error", async () => { if (retryCount < assets.retries.count) { - await new Promise(resolve => setTimeout(resolve, assets.retries.delay + assets.retries.extraDelay * retryCount)); + await new Promise((resolve) => + setTimeout( + resolve, + assets.retries.delay + assets.retries.extraDelay * retryCount + ) + ); linkEl.remove(); - loadCSS(url, retryCount + 1).then(resolve).catch(reject); + loadCSS(url, retryCount + 1) + .then(resolve) + .catch(reject); } else { reject(new AssetsLoadingError(`The loading of ${url} failed`)); } @@ -105,8 +112,7 @@ export const _loadXML = (assets.loadXML = function loadXML(xml, app = defaultApp throw new Error(doc.querySelector("parsererror").textContent.trim()); } - for (const element of doc.querySelectorAll("templates > [t-name][owl]")) { - element.removeAttribute("owl"); + for (const element of doc.querySelectorAll("templates > [t-name]")) { const name = element.getAttribute("t-name"); const previous = templates.querySelector(`[t-name="${name}"]`); if (previous) { diff --git a/addons/web/static/src/legacy/js/assets.js b/addons/web/static/src/legacy/js/assets.js deleted file mode 100644 index 8edc49e1942..00000000000 --- a/addons/web/static/src/legacy/js/assets.js +++ /dev/null @@ -1,20 +0,0 @@ -/** @odoo-module **/ - -import {assets} from "@web/core/assets"; - -const loadXML = assets.loadXML; -assets.loadXML = function (xml, app) { - loadXML(xml, app); - - const doc = new DOMParser().parseFromString(xml, "text/xml"); - const qwebTemplates = document.createElement("templates"); - for (const element of doc.querySelectorAll("templates > [t-name]:not([owl]), templates > [t-extend]:not([owl])")) { - qwebTemplates.appendChild(element); - } - - // don't use require to apply the patch before the first template loading. - odoo.ready('@web/legacy/js/services/core').then(function () { - const { qweb } = odoo.__DEBUG__.services['@web/legacy/js/services/core']; - qweb.add_template(qwebTemplates); - }); -} diff --git a/addons/website_slides/__manifest__.py b/addons/website_slides/__manifest__.py index 7ea5fc07717..68f40322122 100644 --- a/addons/website_slides/__manifest__.py +++ b/addons/website_slides/__manifest__.py @@ -192,7 +192,6 @@ Featuring 'web/static/lib/clipboard/clipboard.js', 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/lib/qweb/qweb2.js', - 'web/static/src/legacy/js/assets.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', 'web/static/src/legacy/js/libs/content-disposition.js',