[REF] web: Add all templates in Owl app
Before this commit, only templates with owl=1 were added to the owl app. Now, all templates are added to the owl app, and none of the templates is added to qweb. Part of task~3443861 Part-of: odoo/odoo#130467
This commit is contained in:
committed by
Samuel Degueldre
parent
2a72028ce6
commit
4703e4a2ef
@@ -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',
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user