[fix] problem with on_changes in the editable lists in o2m

bzr revid: nicolas.vanhoren@openerp.com-20120214152031-br1lq6zqx6ycdj7p
This commit is contained in:
niv-openerp 2012-02-14 16:20:31 +01:00
parent 04849550aa
commit c8912b68d8
2 changed files with 11 additions and 4 deletions

View File

@ -525,7 +525,10 @@ openerp.web.DataSet = openerp.web.OldWidget.extend( /** @lends openerp.web.Data
},
size: function () {
return this.ids.length;
}
},
alter_ids: function(n_ids) {
this.ids = n_ids;
},
});
openerp.web.DataSetStatic = openerp.web.DataSet.extend({
init: function(parent, model, context, ids) {
@ -784,7 +787,11 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({
}
}
return this._super(method, args, callback, error_callback);
}
},
alter_ids: function(n_ids) {
this._super(n_ids);
this.on_change();
},
});
openerp.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/;

View File

@ -565,10 +565,10 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
} else {
this.datarecord.id = r.result;
if (!prepend_on_create) {
this.dataset.ids.push(this.datarecord.id);
this.dataset.alter_ids(this.dataset.ids.concat([this.datarecord.id]));
this.dataset.index = this.dataset.ids.length - 1;
} else {
this.dataset.ids.unshift(this.datarecord.id);
this.dataset.alter_ids([this.datarecord.id].concat(this.dataset.ids));
this.dataset.index = 0;
}
this.do_update_pager();