From 87133a8235aa71db49566e9a1179ab66b68e87ec Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 10 Aug 2017 11:49:15 +0200 Subject: [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. --- addons/web/static/src/js/views/basic/basic_model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') 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, -- cgit v1.2.3