From c24afa8cf6c812e2383ff94841c59e0d54a1320a Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Tue, 4 Jun 2013 09:29:47 +0200 Subject: [PATCH 1/9] [add] module web_export_view copied from 6.1 --- web_export_view/.DS_Store | Bin 0 -> 6148 bytes web_export_view/AUTHORS.txt | 6 + web_export_view/__init__.py | 21 ++++ web_export_view/__openerp__.py | 53 ++++++++ web_export_view/controllers.py | 46 +++++++ .../static/js/web_advanced_export.js | 116 ++++++++++++++++++ 6 files changed, 242 insertions(+) create mode 100644 web_export_view/.DS_Store create mode 100644 web_export_view/AUTHORS.txt create mode 100644 web_export_view/__init__.py create mode 100644 web_export_view/__openerp__.py create mode 100644 web_export_view/controllers.py create mode 100644 web_export_view/static/js/web_advanced_export.js diff --git a/web_export_view/.DS_Store b/web_export_view/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 [simahawk] +Lorenzo Battistini +Stefan Rijnhart diff --git a/web_export_view/__init__.py b/web_export_view/__init__.py new file mode 100644 index 00000000..09691964 --- /dev/null +++ b/web_export_view/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2012 Agile Business Group sagl () +# Copyright (C) 2012 Domsense srl () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +import controllers diff --git a/web_export_view/__openerp__.py b/web_export_view/__openerp__.py new file mode 100644 index 00000000..41008b3d --- /dev/null +++ b/web_export_view/__openerp__.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2012 Domsense srl () +# Copyright (C) 2012-2013 Agile Business Group sagl +# () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + 'name': 'Export Current View', + 'version': '1.0', + 'category': 'Web', + 'description': """ +WEB EXPORT VIEW +=============== + +One of the best OpenERP’s features is exporting custom data to CSV/XLS. You can do it by clicking on the export link in the sidebar. The export action allows use to configure what to be exported by selecting fields, etc, and allows you to save your export as a template so that you can export it once again without having to configure it again. + +That feature is as great and advanced as limited for an everyday-customer-experience. A lot of customers want simply to export the tree view they are looking to. + +If you miss this feature as us, probably you’ll find an answer into our web_export_view module. + +After you installed it, you’ll find an additional link ‘Export current view’ right below the ‘Export’ one. By clicking on it you’ll get a XLS file contains the same data of the tree view you are looking at, headers included. +""", + 'author': 'Agile Business Group', + 'website': 'http://www.agilebg.com', + 'license': 'AGPL-3', + 'depends': ['web'], + 'external_dependencies' : { + 'python' : ['xlwt'], + }, + 'data': [], + 'active': False, + 'auto_install': False, + 'js': [ + 'static/js/web_advanced_export.js', + ], +} + diff --git a/web_export_view/controllers.py b/web_export_view/controllers.py new file mode 100644 index 00000000..ba7f4e1d --- /dev/null +++ b/web_export_view/controllers.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2012 Agile Business Group sagl () +# Copyright (C) 2012 Domsense srl () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +try: + import json +except ImportError: + import simplejson as json + +import web.common.http as openerpweb + +from web.controllers.main import ExcelExport + + +class ExcelExportView(ExcelExport): + _cp_path = '/web/export/xls_view' + + @openerpweb.httprequest + def index(self, req, data, token): + data = json.loads(data) + model = data.get('model',[]) + columns_headers = data.get('headers',[]) + rows = data.get('rows',[]) + + context = req.session.eval_context(req.context) + + return req.make_response(self.from_data(columns_headers, rows), + headers=[('Content-Disposition', 'attachment; filename="%s"' % self.filename(model)), + ('Content-Type', self.content_type)], + cookies={'fileToken': int(token)}) diff --git a/web_export_view/static/js/web_advanced_export.js b/web_export_view/static/js/web_advanced_export.js new file mode 100644 index 00000000..0c26f48b --- /dev/null +++ b/web_export_view/static/js/web_advanced_export.js @@ -0,0 +1,116 @@ +// @@@ web_export_view custom JS @@@ +//############################################################################# +// +// Copyright (C) 2012 Agile Business Group sagl () +// Copyright (C) 2012 Therp BV () +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +//############################################################################# + +openerp.web_export_view = function(openerp) { + + _t = openerp.web._t; + + openerp.web.Sidebar = openerp.web.Sidebar.extend({ + + add_default_sections: function() { + // IMHO sections should be registered objects + // as views and retrieved using a specific registry + // so that we don't have to override this + + var self = this, + view = this.widget_parent, + view_manager = view.widget_parent, + action = view_manager.action; + if (this.session.uid === 1) { + this.add_section(_t('Customize'), 'customize'); + this.add_items('customize', [{ + label: _t("Translate"), + callback: view.on_sidebar_translate, + title: _t("Technical translation") + }]); + } + + this.add_section(_t('Other Options'), 'other'); + this.add_items('other', [ + { + label: _t("Export"), + callback: view.on_sidebar_export + }, + { + label: _t("Export current view"), + callback: this.on_sidebar_export_view + } + ]); + }, + + 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; // valid for list view + if (view.widget_children) { + view.widget_children.every(function(child) { + if (child.field && child.field.type == 'one2many') { + view = child.viewmanager.views.list.controller; + return false; // break out of the loop + } + if (child.field && child.field.type == 'many2many') { + view = child.list_view; + return false; // break out of the loop + } + return true; + }); + } + var columns = view.visible_columns; + export_columns_keys = []; + export_columns_names = []; + $.each(columns,function(){ + if(this.tag=='field'){ + // non-fields like `_group` or buttons + export_columns_keys.push(this.id); + export_columns_names.push(this.string); + } + }); + rows = view.$element.find('.ui-widget-content tr'); + export_rows = []; + $.each(rows,function(){ + $row = $(this); + // find only rows with data + if($row.attr('data-id')){ + export_row = []; + $.each(export_columns_keys,function(){ + cell = $row.find('td[data-field="'+this+'"]').get(0); + text = cell.text || cell.textContent || cell.innerHTML || ""; + export_row.push(text.trim()); + }); + export_rows.push(export_row); + } + }); + $.blockUI(); + view.session.get_file({ + url: '/web/export/xls_view', + data: {data: JSON.stringify({ + model : view.model, + headers : export_columns_names, + rows : export_rows, + })}, + complete: $.unblockUI + }); + }, + + }); + +} From 88a27905a276f74750efa4909b049738e9f52f1a Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Tue, 4 Jun 2013 11:06:55 +0200 Subject: [PATCH 2/9] [add] port web_export_view to OpenERP 7 --- web_export_view/AUTHORS.txt | 1 + web_export_view/__openerp__.py | 36 +++++----- web_export_view/controllers.py | 25 ++++--- .../static/js/web_advanced_export.js | 67 +++++++------------ .../static/xml/web_advanced_export.xml | 13 ++++ 5 files changed, 72 insertions(+), 70 deletions(-) create mode 100644 web_export_view/static/xml/web_advanced_export.xml diff --git a/web_export_view/AUTHORS.txt b/web_export_view/AUTHORS.txt index d7fa7280..76bbca72 100644 --- a/web_export_view/AUTHORS.txt +++ b/web_export_view/AUTHORS.txt @@ -4,3 +4,4 @@ Authors Simone Orsi [simahawk] Lorenzo Battistini Stefan Rijnhart +Leonardo Pistone diff --git a/web_export_view/__openerp__.py b/web_export_view/__openerp__.py index 41008b3d..555f9b27 100644 --- a/web_export_view/__openerp__.py +++ b/web_export_view/__openerp__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # Copyright (C) 2012 Domsense srl () # Copyright (C) 2012-2013 Agile Business Group sagl # () @@ -22,32 +22,38 @@ { 'name': 'Export Current View', - 'version': '1.0', + 'version': '1.1', 'category': 'Web', 'description': """ WEB EXPORT VIEW =============== -One of the best OpenERP’s features is exporting custom data to CSV/XLS. You can do it by clicking on the export link in the sidebar. The export action allows use to configure what to be exported by selecting fields, etc, and allows you to save your export as a template so that you can export it once again without having to configure it again. +One of the best OpenERP’s features is exporting custom data to CSV/XLS. You can +do it by clicking on the export link in the sidebar. The export action allows +use to configure what to be exported by selecting fields, etc, and allows you +to save your export as a template so that you can export it once again without +having to configure it again. -That feature is as great and advanced as limited for an everyday-customer-experience. A lot of customers want simply to export the tree view they are looking to. +That feature is as great and advanced as limited for an everyday experience. +A lot of customers want simply to export the tree view they are looking to. -If you miss this feature as us, probably you’ll find an answer into our web_export_view module. +If you miss this feature as us, probably you’ll find an answer into our +web_export_view module. -After you installed it, you’ll find an additional link ‘Export current view’ right below the ‘Export’ one. By clicking on it you’ll get a XLS file contains the same data of the tree view you are looking at, headers included. +After you installed it, you’ll find an additional link ‘Export current view’ +right below the ‘Export’ one. By clicking on it you’ll get a XLS file contains +the same data of the tree view you are looking at, headers included. """, 'author': 'Agile Business Group', 'website': 'http://www.agilebg.com', 'license': 'AGPL-3', 'depends': ['web'], - 'external_dependencies' : { - 'python' : ['xlwt'], - }, - 'data': [], - 'active': False, + # 'external_dependencies': { + # 'python': ['xlwt'], + # }, + 'js': ['static/*/*.js', 'static/*/js/*.js'], + 'qweb': ['static/xml/web_advanced_export.xml'], + 'installable': True, 'auto_install': False, - 'js': [ - 'static/js/web_advanced_export.js', - ], + 'web_preload': False, } - diff --git a/web_export_view/controllers.py b/web_export_view/controllers.py index ba7f4e1d..dc225ee2 100644 --- a/web_export_view/controllers.py +++ b/web_export_view/controllers.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # Copyright (C) 2012 Agile Business Group sagl () # Copyright (C) 2012 Domsense srl () # @@ -23,7 +23,7 @@ try: except ImportError: import simplejson as json -import web.common.http as openerpweb +import web.http as openerpweb from web.controllers.main import ExcelExport @@ -34,13 +34,16 @@ class ExcelExportView(ExcelExport): @openerpweb.httprequest def index(self, req, data, token): data = json.loads(data) - model = data.get('model',[]) - columns_headers = data.get('headers',[]) - rows = data.get('rows',[]) - - context = req.session.eval_context(req.context) + model = data.get('model', []) + columns_headers = data.get('headers', []) + rows = data.get('rows', []) - return req.make_response(self.from_data(columns_headers, rows), - headers=[('Content-Disposition', 'attachment; filename="%s"' % self.filename(model)), - ('Content-Type', self.content_type)], - cookies={'fileToken': int(token)}) + return req.make_response( + self.from_data(columns_headers, rows), + headers=[ + ('Content-Disposition', 'attachment; filename="%s"' + % self.filename(model)), + ('Content-Type', self.content_type) + ], + cookies={'fileToken': int(token)} + ) diff --git a/web_export_view/static/js/web_advanced_export.js b/web_export_view/static/js/web_advanced_export.js index 0c26f48b..03e05bdd 100644 --- a/web_export_view/static/js/web_advanced_export.js +++ b/web_export_view/static/js/web_advanced_export.js @@ -19,48 +19,25 @@ // //############################################################################# -openerp.web_export_view = function(openerp) { +openerp.web_export_view = function(instance, m) { - _t = openerp.web._t; + var _t = instance.web._t, + QWeb = instance.web.qweb; - openerp.web.Sidebar = openerp.web.Sidebar.extend({ - - add_default_sections: function() { - // IMHO sections should be registered objects - // as views and retrieved using a specific registry - // so that we don't have to override this - - var self = this, - view = this.widget_parent, - view_manager = view.widget_parent, - action = view_manager.action; - if (this.session.uid === 1) { - this.add_section(_t('Customize'), 'customize'); - this.add_items('customize', [{ - label: _t("Translate"), - callback: view.on_sidebar_translate, - title: _t("Technical translation") - }]); - } - - this.add_section(_t('Other Options'), 'other'); - this.add_items('other', [ - { - label: _t("Export"), - callback: view.on_sidebar_export - }, - { - label: _t("Export current view"), - callback: this.on_sidebar_export_view - } - ]); + instance.web.Sidebar.include({ + redraw: function() { + var self = this; + this._super.apply(this, arguments); + self.$el.find('.oe_sidebar').append(QWeb.render('AddExportViewMain', {widget: self})); + self.$el.find('.oe_sidebar_export_view_xls').on('click', self.on_sidebar_export_view_xls); }, - on_sidebar_export_view: function() { + on_sidebar_export_view_xls: 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; // valid for list view + view = this.getParent(), + columns = view.visible_columns; if (view.widget_children) { view.widget_children.every(function(child) { if (child.field && child.field.type == 'one2many') { @@ -74,7 +51,6 @@ openerp.web_export_view = function(openerp) { return true; }); } - var columns = view.visible_columns; export_columns_keys = []; export_columns_names = []; $.each(columns,function(){ @@ -84,19 +60,22 @@ openerp.web_export_view = function(openerp) { export_columns_names.push(this.string); } }); - rows = view.$element.find('.ui-widget-content tr'); + rows = view.$el.find('.oe_list_content > tbody > tr'); export_rows = []; $.each(rows,function(){ $row = $(this); // find only rows with data if($row.attr('data-id')){ export_row = []; - $.each(export_columns_keys,function(){ - cell = $row.find('td[data-field="'+this+'"]').get(0); - text = cell.text || cell.textContent || cell.innerHTML || ""; - export_row.push(text.trim()); - }); - export_rows.push(export_row); + checked = $row.find('th input[type=checkbox]').attr("checked"); + if (checked === "checked"){ + $.each(export_columns_keys,function(){ + cell = $row.find('td[data-field="'+this+'"]').get(0); + text = cell.text || cell.textContent || cell.innerHTML || ""; + export_row.push(text.trim()); + }); + export_rows.push(export_row); + } } }); $.blockUI(); @@ -113,4 +92,4 @@ openerp.web_export_view = function(openerp) { }); -} +}; diff --git a/web_export_view/static/xml/web_advanced_export.xml b/web_export_view/static/xml/web_advanced_export.xml new file mode 100644 index 00000000..cb4b5004 --- /dev/null +++ b/web_export_view/static/xml/web_advanced_export.xml @@ -0,0 +1,13 @@ + + + + +
+ +
    +
  • Excel
  • +
+
+
+
From 8ece7b454389a762e4117a73a3df50c3dd450b51 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Wed, 19 Jun 2013 10:48:27 +0200 Subject: [PATCH 3/9] [fix] .DS_Store --- web_export_view/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 web_export_view/.DS_Store diff --git a/web_export_view/.DS_Store b/web_export_view/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Wed, 19 Jun 2013 11:50:37 +0200 Subject: [PATCH 4/9] [FIX] Convert number string to number --- web_export_view/static/js/web_advanced_export.js | 12 ++++++++++-- 1 file changed, 10 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 03e05bdd..75fb6873 100644 --- a/web_export_view/static/js/web_advanced_export.js +++ b/web_export_view/static/js/web_advanced_export.js @@ -72,10 +72,18 @@ openerp.web_export_view = function(instance, m) { $.each(export_columns_keys,function(){ cell = $row.find('td[data-field="'+this+'"]').get(0); text = cell.text || cell.textContent || cell.innerHTML || ""; - export_row.push(text.trim()); + if (cell.classList.contains("oe_list_field_float")){ + export_row.push(parseFloat(text)); + } + else if (cell.classList.contains("oe_list_field_integer")){ + export_row.push(parseInt(text)); + } + else{ + export_row.push(text.trim()); + } }); export_rows.push(export_row); - } + }; } }); $.blockUI(); From 1b3067aae9cf3e3cb860e7699da0feff0d7000da Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Tue, 23 Jul 2013 15:25:54 +0200 Subject: [PATCH 5/9] [FIX] Compatibility with Werkzeug 0.9.3 --- web_export_view/controllers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_export_view/controllers.py b/web_export_view/controllers.py index dc225ee2..89304e35 100644 --- a/web_export_view/controllers.py +++ b/web_export_view/controllers.py @@ -45,5 +45,5 @@ class ExcelExportView(ExcelExport): % self.filename(model)), ('Content-Type', self.content_type) ], - cookies={'fileToken': int(token)} + cookies={'fileToken': token} ) From f1ee1b1d77efac8b961941b017073ca62b90ec17 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Tue, 23 Jul 2013 15:46:00 +0200 Subject: [PATCH 6/9] [FIX] Export of first one2many field works again --- web_export_view/static/js/web_advanced_export.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web_export_view/static/js/web_advanced_export.js b/web_export_view/static/js/web_advanced_export.js index 75fb6873..e38269ff 100644 --- a/web_export_view/static/js/web_advanced_export.js +++ b/web_export_view/static/js/web_advanced_export.js @@ -37,9 +37,9 @@ openerp.web_export_view = function(instance, m) { // or assume the main view is a list view and use that var self = this, view = this.getParent(), - columns = view.visible_columns; - if (view.widget_children) { - view.widget_children.every(function(child) { + children = view.getChildren(); + if (children) { + children.every(function(child) { if (child.field && child.field.type == 'one2many') { view = child.viewmanager.views.list.controller; return false; // break out of the loop @@ -53,7 +53,7 @@ openerp.web_export_view = function(instance, m) { } export_columns_keys = []; export_columns_names = []; - $.each(columns,function(){ + $.each(view.visible_columns, function(){ if(this.tag=='field'){ // non-fields like `_group` or buttons export_columns_keys.push(this.id); @@ -68,7 +68,7 @@ openerp.web_export_view = function(instance, m) { if($row.attr('data-id')){ export_row = []; checked = $row.find('th input[type=checkbox]').attr("checked"); - if (checked === "checked"){ + if (children || checked === "checked"){ $.each(export_columns_keys,function(){ cell = $row.find('td[data-field="'+this+'"]').get(0); text = cell.text || cell.textContent || cell.innerHTML || ""; From acb4b654ab928bba2ff91245fc71a6ace3d93757 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Sun, 4 Aug 2013 20:35:56 +0200 Subject: [PATCH 7/9] [FIX] Parsing of float values --- web_export_view/static/js/web_advanced_export.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_export_view/static/js/web_advanced_export.js b/web_export_view/static/js/web_advanced_export.js index e38269ff..de13dfa1 100644 --- a/web_export_view/static/js/web_advanced_export.js +++ b/web_export_view/static/js/web_advanced_export.js @@ -73,7 +73,7 @@ openerp.web_export_view = function(instance, m) { cell = $row.find('td[data-field="'+this+'"]').get(0); text = cell.text || cell.textContent || cell.innerHTML || ""; if (cell.classList.contains("oe_list_field_float")){ - export_row.push(parseFloat(text)); + export_row.push(instance.web.parse_value(text, {'type': "float"})); } else if (cell.classList.contains("oe_list_field_integer")){ export_row.push(parseInt(text)); From 134e5c6f889e6752f9de31928564e7863508a902 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Mon, 5 Aug 2013 16:24:40 +0200 Subject: [PATCH 8/9] [FIX] reverting change as it doesn't handle decimal separators != '.' --- web_export_view/static/js/web_advanced_export.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/web_export_view/static/js/web_advanced_export.js b/web_export_view/static/js/web_advanced_export.js index e38269ff..2769046f 100644 --- a/web_export_view/static/js/web_advanced_export.js +++ b/web_export_view/static/js/web_advanced_export.js @@ -72,15 +72,7 @@ openerp.web_export_view = function(instance, m) { $.each(export_columns_keys,function(){ cell = $row.find('td[data-field="'+this+'"]').get(0); text = cell.text || cell.textContent || cell.innerHTML || ""; - if (cell.classList.contains("oe_list_field_float")){ - export_row.push(parseFloat(text)); - } - else if (cell.classList.contains("oe_list_field_integer")){ - export_row.push(parseInt(text)); - } - else{ - export_row.push(text.trim()); - } + export_row.push(text.trim()); }); export_rows.push(export_row); }; From baa52e50a7a85b5be7d91d0480d086d16e6b2373 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Mon, 5 Aug 2013 16:49:22 +0200 Subject: [PATCH 9/9] [FIX] reverting the revert.. --- web_export_view/static/js/web_advanced_export.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web_export_view/static/js/web_advanced_export.js b/web_export_view/static/js/web_advanced_export.js index 2769046f..e38269ff 100644 --- a/web_export_view/static/js/web_advanced_export.js +++ b/web_export_view/static/js/web_advanced_export.js @@ -72,7 +72,15 @@ openerp.web_export_view = function(instance, m) { $.each(export_columns_keys,function(){ cell = $row.find('td[data-field="'+this+'"]').get(0); text = cell.text || cell.textContent || cell.innerHTML || ""; - export_row.push(text.trim()); + if (cell.classList.contains("oe_list_field_float")){ + export_row.push(parseFloat(text)); + } + else if (cell.classList.contains("oe_list_field_integer")){ + export_row.push(parseInt(text)); + } + else{ + export_row.push(text.trim()); + } }); export_rows.push(export_row); };