diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-04-06 19:57:59 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | d1d80a494b2a0a9e55a3232dbff291ea9f65da1b (patch) | |
| tree | 2637cca620dbaaf77f6bdd0e4f97c96e814e7561 /addons/web/static/src/js/views | |
| parent | 64a9398fb385896cafe7725d7361e6131561f606 (diff) | |
[FIX] web: make sure buttons are called with proper res_id
Before this commit, clicking on buttons did not reload the current
record, which is good. However, it kept the reference to the record
after saving, even if that record could have been changed, which is
definitely the case when starting from a new record and saving it (it
will have the correct res_id, which is really important).
Diffstat (limited to 'addons/web/static/src/js/views')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_controller.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/js/views/form/form_controller.js index 4a0561e2eca..7435332ecf4 100644 --- a/addons/web/static/src/js/views/form/form_controller.js +++ b/addons/web/static/src/js/views/form/form_controller.js @@ -454,7 +454,11 @@ var FormController = BasicController.extend({ } else { // save the record but don't switch to readonly mode def = this.saveRecord({stayInEdit: true, reload: false}).then(function () { - return self._callButtonAction(attrs, event.data.record); + // we need to reget the record to make sure we have changes made + // by the basic model, such as the new res_id, if the record is + // new. + var record = self.model.get(event.data.record.id); + return self._callButtonAction(attrs, record); }); } def.then(function () { |
