[IMP] move ListView.List#reload_record to ListView

bzr revid: xmo@openerp.com-20120622135015-dsvjblv1rd4oezcp
This commit is contained in:
Xavier Morel 2012-06-22 15:50:15 +02:00
parent 5182068b43
commit 9e134c9afa
1 changed files with 14 additions and 11 deletions

View File

@ -479,6 +479,19 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
reload: function () {
return this.reload_content();
},
reload_record: function (record) {
return this.dataset.read_ids(
[record.get('id')],
_.pluck(_(this.columns).filter(function (r) {
return r.tag === 'field';
}), 'name')
).then(function (records) {
_(records[0]).each(function (value, key) {
record.set(key, value, {silent: true});
});
record.trigger('change', record);
});
},
do_load_state: function(state, warm) {
var reload = false;
@ -1018,17 +1031,7 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis
* @returns {$.Deferred} promise to the finalization of the reloading
*/
reload_record: function (record) {
return this.dataset.read_ids(
[record.get('id')],
_.pluck(_(this.columns).filter(function (r) {
return r.tag === 'field';
}), 'name')
).then(function (records) {
_(records[0]).each(function (value, key) {
record.set(key, value, {silent: true});
});
record.trigger('change', record);
});
return this.view.reload_record(record);
},
/**
* Renders a list record to HTML