[MERGE] [FIX] One2ManyListView: reload line data without saving it when m2o record has changed in edition mode (eg: changing product name in sale order line) (opw #600224)

bzr revid: mat@openerp.com-20131211105009-iylczcepd3a0e61l
This commit is contained in:
Martin Trigaux 2013-12-11 11:50:09 +01:00
commit ad7951214c
2 changed files with 16 additions and 1 deletions

View File

@ -920,6 +920,15 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
* @param {Object} id record to remove from the BDS's cache
*/
evict_record: function (id) {
// Don't evict records which haven't yet been saved: there is no more
// recent data on the server (and there potentially isn't any data),
// and this breaks the assumptions of other methods (that the data
// for new and altered records is both in the cache and in the to_write
// or to_create collection)
if (_(this.to_create.concat(this.to_write)).find(function (record) {
return record.id === id; })) {
return;
}
for(var i=0, len=this.cache.length; i<len; ++i) {
var record = this.cache[i];
// if record we call the button upon is in the cache

View File

@ -3834,7 +3834,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
var ret = this._super();
this.$el
.off('mousedown.handleButtons')
.on('mousedown.handleButtons', 'table button', this.proxy('_button_down'));
.on('mousedown.handleButtons', 'table button, div a.oe_m2o_cm_button', this.proxy('_button_down'));
return ret;
},
changed_records: function () {
@ -3993,6 +3993,12 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
} finally {
window.confirm = confirm;
}
},
reload_record: function (record) {
// Evict record.id from cache to ensure it will be reloaded correctly
this.dataset.evict_record(record.get('id'));
return this._super(record);
}
});
instance.web.form.One2ManyGroups = instance.web.ListView.Groups.extend({