[IMP] Add action help if noaction on deshbaord

bzr revid: jam@tinyerp.com-20120607103647-8ylpddobydc6ed1d
This commit is contained in:
Jigar Amin - OpenERP
2012-06-07 16:06:47 +05:30
parent 7c8ed0a00c
commit fc9901c7a5
@@ -231,6 +231,15 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
}
},
renderElement: function() {
var self = this;
//to Check dash contains any action if not then show the action help
var array= [];
_.each(this.node.children, function(column, column_index) {
array.push(_.include(_.pluck(column.children,"tag"),"action"));
});
if (! _.include(array,true)){
return self.no_result();
}
// We should start with three columns available
for (var i = this.node.children.length; i < 3; i++) {
this.node.children.push({
@@ -242,6 +251,17 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
var rendered = QWeb.render(this.form_template, this);
this.$element.html(rendered);
},
no_result: function () {
if (!this.view.options.action
|| !this.view.options.action.help) {
return;
}
this.$element.prepend(
$('<div class="oe_view_nocontent">')
.append($('<img>', { src: '/web_dashboard/static/src/img/view_todo_arrow.png' }))
.append($('<div>').html(this.view.options.action.help))
);
},
do_reload: function() {
var view_manager = this.view.getParent(),
action_manager = view_manager.getParent();