summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-08-10 11:49:15 +0200
committerAaron Bohy <aab@odoo.com>2017-08-10 13:56:22 +0200
commit87133a8235aa71db49566e9a1179ab66b68e87ec (patch)
tree6e06c1062e95f9a95d27be4b5aae2c6e7c0ec8b4 /addons/web/static/src/js/views/basic/basic_model.js
parent9b4c8a4e318cdabbd21ebb28c61b17ad02874daa (diff)
[FIX] web: BasicModel: correctly reload new records
Commit 7cd2f6370 (in 10.0) recently added attribute special='cancel' on the 'Cancel' buttons of the Settings views in Odoo. The attribute wasn't really supported in this case by the old web framework, so this commit also slightly adapted it, and made it reload the whole webclient when such a button is clicked. This commit now needs to be forwardported in saas-16, so we have to handle the case in the new views as well. Before this rev., it crashed, because the BasicModel tried to reload a new record (the one of the Settings form view), so basically it performed a 'read' RPC on a virtual ID like 'virtual_123', and the server didn't really appreciate. This rev. handles the case where a new record is reloaded, and simply performs a 'default_get' instead of a read. Bonus point: with the new views, we don't have to reload the whole webclient.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index 288186e4d5a..8755805f993 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -649,7 +649,7 @@ var BasicModel = AbstractModel.extend({
var element = this.localData[id];
if (element.type === 'record') {
- if ('currentId' in options && !options.currentId) {
+ if (!options.currentId && (('currentId' in options) || this.isNew(id))) {
var params = {
context: element.context,
fieldsInfo: element.fieldsInfo,