summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework/ajax.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/framework/ajax.js')
-rw-r--r--addons/web/static/src/js/framework/ajax.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/web/static/src/js/framework/ajax.js b/addons/web/static/src/js/framework/ajax.js
index dd1eee906c1..ce61f225524 100644
--- a/addons/web/static/src/js/framework/ajax.js
+++ b/addons/web/static/src/js/framework/ajax.js
@@ -275,11 +275,45 @@ function get_file(options) {
};
+var loadXML = (function () {
+ var loading = false;
+ var urls = [];
+ var qwebs = [];
+ var templates_def = $.Deferred();
+
+ var load = function loadXML(url, qweb) {
+ if (url) {
+ urls.push(url);
+ qwebs.push(qweb);
+ }
+
+ if (!loading && urls.length) {
+ if (templates_def.state() === "resolved") {
+ templates_def = $.Deferred();
+ }
+
+ loading = true;
+ qwebs.shift().add_template(urls.shift(), function () {
+ loading = false;
+ if (!urls.length) {
+ templates_def.resolve();
+ }
+ load(null);
+ });
+ }
+
+ return templates_def;
+ };
+
+ return load;
+})();
+
return {
jsonRpc: jsonRpc,
jsonpRpc: jsonpRpc,
loadCSS: loadCSS,
loadJS: loadJS,
+ loadXML: loadXML,
get_file: get_file,
};