[FIX] only reload m2m listview once after adding n records to it (via dialog)

The listview does not support concurrent reload requests, either wait
for the previous reload to finish before sending the new one, or just
send a single reload.

For m2m, can wait and do a single reload so do that.

bzr revid: xmo@openerp.com-20121018134123-ox2ccq0wm3r5jwas
This commit is contained in:
Xavier Morel 2012-10-18 15:41:23 +02:00
parent f910bc6780
commit 6782c33a32
1 changed files with 8 additions and 4 deletions

View File

@ -4048,13 +4048,17 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in
);
var self = this;
pop.on("elements_selected", self, function(element_ids) {
_.each(element_ids, function(one_id) {
if(! _.detect(self.dataset.ids, function(x) {return x == one_id;})) {
self.dataset.set_ids([].concat(self.dataset.ids, [one_id]));
var reload = false;
_(element_ids).each(function (id) {
if(! _.detect(self.dataset.ids, function(x) {return x == id;})) {
self.dataset.set_ids(self.dataset.ids.concat([id]));
self.m2m_field.dataset_changed();
self.reload_content();
reload = true;
}
});
if (reload) {
self.reload_content();
}
});
},
do_activate_record: function(index, id) {