summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/form
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-09-13 13:32:51 +0000
committerChristophe Simonis <chs@odoo.com>2019-09-13 13:32:51 +0000
commit5a273e74f0fff18df5ab6cb240c9e260be4bb7ff (patch)
tree4fbc7e142335d110fa0a984ff2c345a487e37ca4 /addons/web/static/src/js/views/form
parentdc5f83b63313018999b598210b972636986c5bea (diff)
parentfe59754c5201f9392b75d5d4cce8ca1400a7ef5d (diff)
[MERGE] forward port branch saas-12.4 up to fe59754c520
closes odoo/odoo#36721 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.js4
-rw-r--r--addons/web/static/src/js/views/form/form_view.js4
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 22de0e8d68b..bd31cddd50d 100644
--- a/addons/web/static/src/js/views/form/form_controller.js
+++ b/addons/web/static/src/js/views/form/form_controller.js
@@ -631,7 +631,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 95b84423444..13d73cf37c2 100644
--- a/addons/web/static/src/js/views/form/form_view.js
+++ b/addons/web/static/src/js/views/form/form_view.js
@@ -123,6 +123,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(),