From 8d620bb46f916624ca6eed6c3cee912b6fd5efea Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Sun, 20 Jan 2013 16:12:43 +0100 Subject: [PATCH] [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 --- .../static/js/web_advanced_export.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/web_export_view/static/js/web_advanced_export.js b/web_export_view/static/js/web_advanced_export.js index a93dfabd..c644440e 100644 --- a/web_export_view/static/js/web_advanced_export.js +++ b/web_export_view/static/js/web_advanced_export.js @@ -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(){