[IMP] Export first list view if main view is page

Thanks to Stefan Rijnhart
http://bazaar.launchpad.net/~therp-nl/domsense-agilebg-web-addons/6.1-export_first_list__in_form_view/revision/18
pull/2/head
Lorenzo Battistini 2013-01-20 16:12:43 +01:00
parent 45acc85b5c
commit 8d620bb46f
1 changed files with 15 additions and 2 deletions

View File

@ -41,9 +41,22 @@ openerp.web_export_view = function(openerp) {
},
on_sidebar_export_view: function() {
// Select the first list of the current (form) view
// or assume the main view is a list view and use that
var self = this,
view = this.widget_parent,
columns = view.visible_columns;
view = this.widget_parent; // valid for list view
if (view.widget_children) {
view.widget_children.every(function(child) {
if (child.field && (
child.field.type == 'many2many'
|| child.field.type == 'one2many')) {
view = child.viewmanager.views.list.controller;
return false; // break out of the loop
}
return true;
});
}
var columns = view.visible_columns;
export_columns_keys = [];
export_columns_names = [];
$.each(columns,function(){