[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).
This commit is contained in:
Aaron Bohy
2015-01-28 16:08:56 +01:00
parent 40b8fdec00
commit 9c504fcacd
+4 -3
View File
@@ -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),