summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2015-01-28 14:54:58 +0100
committerAaron Bohy <aab@odoo.com>2015-01-28 16:08:56 +0100
commit9c504fcacd38d52caca96ff280efe75c43c93e01 (patch)
treeb06f2fea87dfdaf67585350b4a0f49eaa7c02da1 /addons/web/static/src/js/views.js
parent40b8fdec0053cae5e293382cc2bb90ba45ede550 (diff)
[FIX] Web: views.js: use initial_mode edit
Use the option initial_mode of views when openning a view in 'edit' mode at first rendering. This fixes a bug with FieldOne2Many widgets whose buttons were not displayed at first rendering in 'edit' mode (e.g. in the Sales Team FormView).
Diffstat (limited to 'addons/web/static/src/js/views.js')
-rw-r--r--addons/web/static/src/js/views.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index 39a082ff21e..3399a98af9f 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -664,7 +664,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
this.active_view = view;
if (!view.created) {
- view.created = this.create_view.bind(this)(view);
+ view.created = this.create_view.bind(this)(view, view_options);
}
this.active_search = $.Deferred();
@@ -732,13 +732,14 @@ instance.web.ViewManager = instance.web.Widget.extend({
return $bc;
}
},
- create_view: function(view) {
+ create_view: function(view, view_options) {
var self = this,
View = this.registry.get_object(view.type),
options = _.clone(view.options),
view_loaded = $.Deferred();
- if (view.type === "form" && this.action && (this.action.target === 'new' || this.action.target === 'inline')) {
+ if (view.type === "form" && ((this.action && (this.action.target === 'new' || this.action.target === 'inline'))
+ || (view_options && view_options.mode === 'edit'))) {
options.initial_mode = 'edit';
}
var controller = new View(this, this.dataset, view.view_id, options),