[FIX]Web: Fixed the issue of immediate update of many2one field when many2one object name has been changed from follow button popup, reloaded the record from database forcefull to update dataaset, do not call form-blur when follow button is clicked, also do not evict record when record is still not created.

bzr revid: msh@openerp.com-20131203123856-gce4li1igo9k1mak
This commit is contained in:
Mohammed Shekha (OpenERP) 2013-12-03 18:08:56 +05:30
parent a092227c6e
commit b3391cd7fe
2 changed files with 16 additions and 0 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

@ -3836,6 +3836,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
this.$el
.off('mousedown.handleButtons')
.on('mousedown.handleButtons', 'table button', this.proxy('_button_down'));
this.$el.off('mousedown.handleAnchor').on('mousedown.handleAnchor', 'div a', this.proxy('_button_down'))
return ret;
},
changed_records: function () {
@ -3995,6 +3996,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({