[FIX] Use $.Mutex for qweb loading
bzr revid: fme@openerp.com-20111219143406-mdscr8htgto5zcw5
This commit is contained in:
parent
bc3815e26e
commit
15f4b2505a
|
@ -359,6 +359,7 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
|
||||||
this.debug = ($.deparam($.param.querystring()).debug != undefined);
|
this.debug = ($.deparam($.param.querystring()).debug != undefined);
|
||||||
// TODO: session store in cookie should be optional
|
// TODO: session store in cookie should be optional
|
||||||
this.name = openerp._session_id;
|
this.name = openerp._session_id;
|
||||||
|
this.qweb_mutex = new $.Mutex();
|
||||||
},
|
},
|
||||||
bind: function(origin) {
|
bind: function(origin) {
|
||||||
var window_origin = location.protocol+"//"+location.host;
|
var window_origin = location.protocol+"//"+location.host;
|
||||||
|
@ -688,15 +689,14 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
|
||||||
},
|
},
|
||||||
do_load_qweb: function(files) {
|
do_load_qweb: function(files) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (files.length != 0) {
|
_.each(files, function(file) {
|
||||||
var file = files.shift();
|
self.qweb_mutex.exec(function() {
|
||||||
return self.rpc('/web/proxy/load', {path: file}).pipe(function(xml) {
|
return self.rpc('/web/proxy/load', {path: file}).pipe(function(xml) {
|
||||||
openerp.web.qweb.add_template(_.str.trim(xml));
|
openerp.web.qweb.add_template(_.str.trim(xml));
|
||||||
return self.do_load_qweb(files);
|
});
|
||||||
});
|
});
|
||||||
} else {
|
});
|
||||||
return $.when();
|
return self.qweb_mutex.def;
|
||||||
}
|
|
||||||
},
|
},
|
||||||
on_modules_loaded: function() {
|
on_modules_loaded: function() {
|
||||||
for(var j=0; j<this.module_list.length; j++) {
|
for(var j=0; j<this.module_list.length; j++) {
|
||||||
|
@ -1171,10 +1171,6 @@ openerp.web.qweb.format_text_node = function(s) {
|
||||||
return tr === ts ? s : tr;
|
return tr === ts ? s : tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Setup default connection */
|
|
||||||
openerp.connection = new openerp.web.Connection();
|
|
||||||
openerp.web.qweb.default_dict['__debug__'] = openerp.connection.debug;
|
|
||||||
|
|
||||||
/** Jquery extentions */
|
/** Jquery extentions */
|
||||||
$.Mutex = (function() {
|
$.Mutex = (function() {
|
||||||
function Mutex() {
|
function Mutex() {
|
||||||
|
@ -1192,6 +1188,11 @@ $.Mutex = (function() {
|
||||||
return Mutex;
|
return Mutex;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
/** Setup default connection */
|
||||||
|
openerp.connection = new openerp.web.Connection();
|
||||||
|
openerp.web.qweb.default_dict['__debug__'] = openerp.connection.debug;
|
||||||
|
|
||||||
|
|
||||||
$.async_when = function() {
|
$.async_when = function() {
|
||||||
var async = false;
|
var async = false;
|
||||||
var def = $.Deferred();
|
var def = $.Deferred();
|
||||||
|
|
Loading…
Reference in New Issue