diff options
| author | Xavier Morel <xmo@openerp.com> | 2012-06-22 17:01:17 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2012-06-22 17:01:17 +0200 |
| commit | d64f983fce0245961ba8851f922962b3106ccc11 (patch) | |
| tree | 9a4bed7c180b5ecb0771cc137eaa904139fe8954 /addons/web/static/src/js | |
| parent | 9e134c9afa77cf7dc54650da13240bc1ed59916d (diff) | |
[FIX] correctly reload an o2m list *after* triggering an action from a row being edited
bzr revid: xmo@openerp.com-20120622150117-w04eibub93ve81mo
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index d9badd9ba6a..edee9bfec74 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2617,12 +2617,39 @@ openerp.web.form.One2ManyListView = openerp.web.ListView.extend({ }); }, do_button_action: function (name, id, callback) { - var self = this; var _super = _.bind(this._super, this); this.o2m.view.do_save().then(function () { _super(name, id, callback); }); + }, + reload_content: function () { + var self = this; + return this._super().then(function () { + _.each(self.groups.children, self.proxy('hook_form_action')); + }); + }, + /** + * Goes through all the lists in order to override their form's + * execute_action to perform a simple reload_record after the action is + * done. + * + * Goes through ListView.List.save_row to do so, to ensure it has a valid + * form as there are no other hook points + */ + hook_form_action: function (list) { + var self = this; + var _save_row = list.save_row; + list.save_row = function () { + var _execute_action = this.edition_form.do_execute_action; + this.edition_form.do_execute_action = function (action, dataset, record_id, _callback) { + return _execute_action.call(this, action, dataset, record_id, function () { + self.reload_record( + self.records.get(record_id)); + }); + }; + return _save_row.apply(this, arguments); + } } }); |
