diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-09-11 09:39:33 +0000 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-09-11 09:39:33 +0000 |
| commit | 51354fadb0a1bf5fa797c2539e703cf97d768691 (patch) | |
| tree | 223535044b0df6473cd343079167c53c0f3673d0 /addons/web/static/src/js/views/form | |
| parent | da6f24bb4cea8b14eacc3040a06c5e451511240f (diff) | |
| parent | 50e571acf7c9696954d604de9b4501716fa26646 (diff) | |
[MERGE] forward port branch saas-12.3 up to 50e571acf7c
closes odoo/odoo#36491
Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/form')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_controller.js | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/form/form_view.js | 4 |
2 files changed, 7 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 5aef3d54bfa..6ffcb81b3f4 100644 --- a/addons/web/static/src/js/views/form/form_controller.js +++ b/addons/web/static/src/js/views/form/form_controller.js @@ -588,7 +588,9 @@ var FormController = BasicController.extend({ * @private */ _onEdit: function () { - this._setMode('edit'); + // wait for potential pending changes to be saved (done with widgets + // allowing to edit in readonly) + this.mutex.getUnlockedDef().then(this._setMode.bind(this, 'edit')); }, /** * This method is called when someone tries to freeze the order, most likely diff --git a/addons/web/static/src/js/views/form/form_view.js b/addons/web/static/src/js/views/form/form_view.js index 0703d9713d5..4889a27f9e5 100644 --- a/addons/web/static/src/js/views/form/form_view.js +++ b/addons/web/static/src/js/views/form/form_view.js @@ -127,6 +127,10 @@ var FormView = BasicView.extend({ var refinedContext = _.pick(self.loadParams.context, function (value, key) { return key.indexOf('_view_ref') === -1; }); + // Specify the main model to prevent access rights defined in the context + // (e.g. create: 0) to apply to subviews. We use here the same logic as + // the one applied by the server for inline views. + refinedContext.base_model_name = self.controllerParams.modelName; defs.push(parent.loadViews( field.relation, new Context(context, self.userContext, refinedContext).eval(), |
