[ADD] Add 'options' to do_switch_view() piped to do_show()
bzr revid: fme@openerp.com-20120607160801-z86cgeo00epiyq61
This commit is contained in:
parent
c7e32e7175
commit
0cc5148b8c
|
@ -208,8 +208,9 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
do_show: function () {
|
do_show: function (options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
options = options || {};
|
||||||
if (this.sidebar) {
|
if (this.sidebar) {
|
||||||
this.sidebar.$element.show();
|
this.sidebar.$element.show();
|
||||||
}
|
}
|
||||||
|
@ -233,6 +234,9 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form.
|
||||||
}).pipe(self.on_record_loaded);
|
}).pipe(self.on_record_loaded);
|
||||||
}
|
}
|
||||||
result.pipe(function() {
|
result.pipe(function() {
|
||||||
|
if (options.editable) {
|
||||||
|
self.set({mode: "edit"});
|
||||||
|
}
|
||||||
self.$element.css('visibility', 'visible');
|
self.$element.css('visibility', 'visible');
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -267,7 +267,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
|
||||||
* @param {Boolean} [no_store=false] don't store the view being switched to on the switch stack
|
* @param {Boolean} [no_store=false] don't store the view being switched to on the switch stack
|
||||||
* @returns {jQuery.Deferred} new view loading promise
|
* @returns {jQuery.Deferred} new view loading promise
|
||||||
*/
|
*/
|
||||||
on_mode_switch: function(view_type, no_store) {
|
on_mode_switch: function(view_type, no_store, view_options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var view = this.views[view_type];
|
var view = this.views[view_type];
|
||||||
var view_promise;
|
var view_promise;
|
||||||
|
@ -330,7 +330,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
|
||||||
var controller = self.views[view_name].controller;
|
var controller = self.views[view_name].controller;
|
||||||
if (controller) {
|
if (controller) {
|
||||||
if (view_name === view_type) {
|
if (view_name === view_type) {
|
||||||
controller.do_show();
|
controller.do_show(view_options || {});
|
||||||
} else {
|
} else {
|
||||||
controller.do_hide();
|
controller.do_hide();
|
||||||
}
|
}
|
||||||
|
@ -347,8 +347,8 @@ instance.web.ViewManager = instance.web.Widget.extend({
|
||||||
* to be extended by child classes to change the default behavior, which simply
|
* to be extended by child classes to change the default behavior, which simply
|
||||||
* consist to switch to the asked view.
|
* consist to switch to the asked view.
|
||||||
*/
|
*/
|
||||||
switch_view: function(view_type, no_store) {
|
switch_view: function(view_type, no_store, options) {
|
||||||
return this.on_mode_switch(view_type, no_store);
|
return this.on_mode_switch(view_type, no_store, options);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns to the view preceding the caller view in this manager's
|
* Returns to the view preceding the caller view in this manager's
|
||||||
|
@ -651,10 +651,10 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
|
||||||
}, action || {});
|
}, action || {});
|
||||||
this.do_action(action);
|
this.do_action(action);
|
||||||
},
|
},
|
||||||
on_mode_switch: function (view_type, no_store) {
|
on_mode_switch: function (view_type, no_store, options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
return $.when(this._super(view_type, no_store)).then(function () {
|
return $.when(this._super.apply(this, arguments)).then(function () {
|
||||||
var controller = self.views[self.active_view].controller,
|
var controller = self.views[self.active_view].controller,
|
||||||
fvg = controller.fields_view,
|
fvg = controller.fields_view,
|
||||||
view_id = (fvg && fvg.view_id) || '--';
|
view_id = (fvg && fvg.view_id) || '--';
|
||||||
|
|
|
@ -325,7 +325,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||||
},
|
},
|
||||||
open_record: function(id) {
|
open_record: function(id) {
|
||||||
if (this.dataset.select_id(id)) {
|
if (this.dataset.select_id(id)) {
|
||||||
this.do_switch_view('form');
|
this.do_switch_view('form', null, { editable: true });
|
||||||
} else {
|
} else {
|
||||||
this.do_warn("Kanban: could not find id#" + id);
|
this.do_warn("Kanban: could not find id#" + id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue