[FIX] Manually aplied search_view and sidebar false for dashboard action.

bzr revid: vda@tinyerp.com-20110428033300-qohzs9tcxak9b35f
This commit is contained in:
vda (OpenERP)
2011-04-28 09:03:00 +05:30
parent 023119776d
commit cc9b3c76de
3 changed files with 36 additions and 21 deletions
+5 -1
View File
@@ -42,7 +42,11 @@ openerp.base.ActionManager = openerp.base.Controller.extend({
if (this.viewmanager) {
this.viewmanager.stop();
}
this.viewmanager = new openerp.base.ViewManagerAction(this.session, this.element_id, action, true);
var sidebar = true;
if(action.no_sidebar) {
sidebar = false;
}
this.viewmanager = new openerp.base.ViewManagerAction(this.session, this.element_id, action, sidebar);
this.viewmanager.start();
}
break;
+6 -6
View File
@@ -1,4 +1,4 @@
from base.controllers.main import View
from base.controllers.main import View, clean_action
import openerpweb
class Dashboard(View):
@@ -7,11 +7,11 @@ class Dashboard(View):
@openerpweb.jsonrequest
def load(self, req, node_attrs):
self.action_id = int(node_attrs['name'])
action_id = int(node_attrs['name'])
actions = req.session.model('ir.actions.actions')
result = actions.read([self.action_id],['type'], req.session.context)
result = actions.read([action_id],['type'], req.session.context)
if not result:
raise _('Action not found!')
self.action = req.session.model(result[0]['type']).read([self.action_id], False, req.session.context)[0]
return {'action': self.action}
action = req.session.model(result[0]['type']).read([action_id], False, req.session.context)[0]
clean_action(action, req.session)
return {'action': action}
@@ -18,12 +18,11 @@ openerp.base.form.Board = openerp.base.form.Widget.extend({
jQuery('body').append(
jQuery('<div>', {'id': 'dashboard_template'}).load('/base_dashboard/static/src/dashboard_template.html',self.on_loaded).hide()
)
},
on_loaded: function() {
var children = this.node.children;
var get_column = ['first', 'second', 'third'];
var board = jQuery('#dashboard').dashboard({
layoutClass:'layout'
});
@@ -32,22 +31,18 @@ openerp.base.form.Board = openerp.base.form.Widget.extend({
var ch_widgets = children[ch].children;
for(var chld = 0; chld < ch_widgets.length; chld++) {
var widget_type = ch_widgets[chld].tag;
var board_element = board.element.find('[id=column-'+get_column[chld]+']');
var widget = new (openerp.base.form.widgets.get_object(widget_type)) (this.view, ch_widgets[chld], board_element);
board.addWidget({
'id': ch_widgets[chld].attrs.name,
'title': ch_widgets[chld].attrs.string,
'url': widget.start()
}, board_element)
var widget = new (openerp.base.form.widgets.get_object(widget_type)) (this.view, ch_widgets[chld], board, chld);
widget.start();
}
}
}
});
openerp.base.form.Action = openerp.base.form.Widget.extend({
init: function(view, node, column) {
this._super(view, node, column);
this.template = "Action";
init: function(view, node, board,child_index) {
this._super(view, node, board,child_index);
this.board = board;
this.child_index = child_index;
},
start: function() {
this._super.apply(this, arguments);
@@ -59,9 +54,25 @@ openerp.base.form.Action = openerp.base.form.Widget.extend({
on_load_action: function(result) {
var action = result.action;
action_manager = new openerp.base.ActionManager(this.session, this.$element.attr('id'));
if(action.search_view)
action.search_view = false;
action.no_sidebar = true;
var node_attrs = this.node.attrs;
var get_column = ['first', 'second', 'third'];
var board_element = this.board.element.find('[id=column-'+get_column[this.child_index]+']');
this.board.addWidget({
'id': node_attrs.name,
'title': node_attrs.string,
}, board_element);
var content_id = node_attrs.name+'-widgetcontent';
this.board.getWidget(node_attrs.name).element.find('.widgetcontent').attr('id',content_id)
action_manager = new openerp.base.ActionManager(this.session, content_id);
action_manager.start();
action_manager.do_action(action);
this.board.getWidget(node_attrs.name).url = action_manager.do_action(action);
}
})