[IMP] override on_debug_changed method.

bzr revid: vme@tinyerp.com-20120731134406-6pornq9phwnahia3
This commit is contained in:
Vidhin Mehta (OpenERP) 2012-07-31 19:14:06 +05:30
parent 97554eef3b
commit ed0d89e659
2 changed files with 18 additions and 9 deletions

View File

@ -756,15 +756,6 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
width: '95%'}, $root).open();
});
break;
case 'manage_views':
if (current_view.fields_view && current_view.fields_view.arch) {
var view_editor = new instance.web_view_editor.ViewEditor(current_view, current_view.$element, this.dataset, current_view.fields_view.arch);
view_editor.start();
} else {
this.do_warn(_t("Manage Views"),
_t("Could not find current view declaration"));
}
break;
case 'edit_workflow':
return this.do_action({
res_model : 'workflow',

View File

@ -1,6 +1,24 @@
openerp.web_view_editor = function(instance) {
var _t = instance.web._t;
var QWeb = instance.web.qweb;
instance.web_view_editor.ViewManagerAction = instance.web.ViewManagerAction.include({
on_debug_changed:function(evt){
var val = $(evt.currentTarget).find('option:selected').val(),
current_view = this.views[this.active_view].controller;
if(val === "manage_views"){
if (current_view.fields_view && current_view.fields_view.arch) {
var view_editor = new instance.web_view_editor.ViewEditor(current_view, current_view.$element, this.dataset, current_view.fields_view.arch);
view_editor.start();
} else {
this.do_warn(_t("Manage Views"),
_t("Could not find current view declaration"));
}
evt.currentTarget.selectedIndex = 0;
}else{
return this._super.apply(this,arguments);
}
}
})
instance.web_view_editor.ViewEditor = instance.web.OldWidget.extend({
init: function(parent, element_id, dataset, view, options) {
this._super(parent);