mirror of https://github.com/OCA/web.git
[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/18pull/2/head
parent
45acc85b5c
commit
8d620bb46f
|
@ -41,9 +41,22 @@ openerp.web_export_view = function(openerp) {
|
||||||
},
|
},
|
||||||
|
|
||||||
on_sidebar_export_view: function() {
|
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,
|
var self = this,
|
||||||
view = this.widget_parent,
|
view = this.widget_parent; // valid for list view
|
||||||
columns = view.visible_columns;
|
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_keys = [];
|
||||||
export_columns_names = [];
|
export_columns_names = [];
|
||||||
$.each(columns,function(){
|
$.each(columns,function(){
|
||||||
|
|
Loading…
Reference in New Issue