[IMP] move ListView.List#reload_record to ListView
bzr revid: xmo@openerp.com-20120622135015-dsvjblv1rd4oezcp
This commit is contained in:
parent
5182068b43
commit
9e134c9afa
|
@ -479,6 +479,19 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
|
||||||
reload: function () {
|
reload: function () {
|
||||||
return this.reload_content();
|
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) {
|
do_load_state: function(state, warm) {
|
||||||
var reload = false;
|
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
|
* @returns {$.Deferred} promise to the finalization of the reloading
|
||||||
*/
|
*/
|
||||||
reload_record: function (record) {
|
reload_record: function (record) {
|
||||||
return this.dataset.read_ids(
|
return this.view.reload_record(record);
|
||||||
[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);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Renders a list record to HTML
|
* Renders a list record to HTML
|
||||||
|
|
Loading…
Reference in New Issue