[FIX] list view: serialize concurrent calls when loading files and ensure consistency of variables (prevent selection of items in list view lost, opw #599969)
bzr revid: mat@openerp.com-20131025145519-jio03azp64ppi5ro
This commit is contained in:
parent
1632666101
commit
d524b95172
|
@ -496,7 +496,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
||||||
*
|
*
|
||||||
* @returns {$.Deferred} promise to content reloading
|
* @returns {$.Deferred} promise to content reloading
|
||||||
*/
|
*/
|
||||||
reload_content: function () {
|
reload_content: synchronized(function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.$el.find('.oe_list_record_selector').prop('checked', false);
|
self.$el.find('.oe_list_record_selector').prop('checked', false);
|
||||||
this.records.reset();
|
this.records.reset();
|
||||||
|
@ -519,7 +519,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
||||||
limit: this._limit
|
limit: this._limit
|
||||||
});
|
});
|
||||||
return reloaded.promise();
|
return reloaded.promise();
|
||||||
},
|
}),
|
||||||
reload: function () {
|
reload: function () {
|
||||||
return this.reload_content();
|
return this.reload_content();
|
||||||
},
|
},
|
||||||
|
@ -1601,6 +1601,22 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializes concurrent calls to this asynchronous method. The method must
|
||||||
|
* return a deferred or promise.
|
||||||
|
*
|
||||||
|
* Current-implementation is class-serialized (the mutex is common to all
|
||||||
|
* instances of the list view). Can be switched to instance-serialized if
|
||||||
|
* having concurrent list views becomes possible and common.
|
||||||
|
*/
|
||||||
|
function synchronized(fn) {
|
||||||
|
var fn_mutex = new $.Mutex();
|
||||||
|
return function () {
|
||||||
|
var args = _.toArray(arguments);
|
||||||
|
args.unshift(this);
|
||||||
|
return fn_mutex.exec(fn.bind.apply(fn, args));
|
||||||
|
};
|
||||||
|
}
|
||||||
var DataGroup = instance.web.Class.extend({
|
var DataGroup = instance.web.Class.extend({
|
||||||
init: function(parent, model, domain, context, group_by, level) {
|
init: function(parent, model, domain, context, group_by, level) {
|
||||||
this.model = new instance.web.Model(model, context, domain);
|
this.model = new instance.web.Model(model, context, domain);
|
||||||
|
|
Loading…
Reference in New Issue