From f9e475af1e4d03cd705577bd6abb4087cc9cf23a Mon Sep 17 00:00:00 2001 From: Henry Zhou Date: Mon, 21 Nov 2016 15:39:17 +0800 Subject: [PATCH] [MIG 10.0] web_export_view (#444) --- web_export_view/README.rst | 28 ++++-- web_export_view/__init__.py | 20 +--- web_export_view/__manifest__.py | 40 +++----- web_export_view/controllers/__init__.py | 20 +--- web_export_view/controllers/controllers.py | 36 ++----- web_export_view/i18n/de.po | 44 --------- web_export_view/i18n/es.po | 46 --------- web_export_view/i18n/fr.po | 44 --------- web_export_view/i18n/is.po | 46 --------- web_export_view/i18n/nl.po | 44 --------- web_export_view/i18n/sl.po | 47 --------- web_export_view/i18n/web_export_view.pot | 43 -------- web_export_view/i18n/zh_CN.po | 38 +++++++ .../static/src/js/web_export_view.js | 99 ++++++++----------- .../src/xml/web_export_view_template.xml | 13 ++- web_export_view/view/web_export_view.xml | 11 --- .../views/web_export_view_view.xml | 9 ++ 17 files changed, 142 insertions(+), 486 deletions(-) delete mode 100644 web_export_view/i18n/de.po delete mode 100644 web_export_view/i18n/es.po delete mode 100644 web_export_view/i18n/fr.po delete mode 100644 web_export_view/i18n/is.po delete mode 100644 web_export_view/i18n/nl.po delete mode 100644 web_export_view/i18n/sl.po delete mode 100644 web_export_view/i18n/web_export_view.pot create mode 100644 web_export_view/i18n/zh_CN.po delete mode 100644 web_export_view/view/web_export_view.xml create mode 100644 web_export_view/views/web_export_view_view.xml diff --git a/web_export_view/README.rst b/web_export_view/README.rst index 6a0ccb67..4f765987 100644 --- a/web_export_view/README.rst +++ b/web_export_view/README.rst @@ -4,7 +4,7 @@ Export Current View =================== -One of the best OpenERP's features is exporting custom data to CSV/XLS. You can +One of the best Odoo'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 us 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 @@ -21,19 +21,31 @@ Usage ===== 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 +right on the sidebar. By clicking on it you'll get a XLS file contains the same data of the tree view you are looking at, headers included. +Known Issues +============ + +Pedro M. Baeza (pedro.baeza@gmail.com): +When you have groups, they are not exported to Excel. It would be desirable to have this option. +One of the problems with this module is that you can't export data from a view with mode="tree". +Changing the approach to have the button always visible (we should relocate it also to another place, +as the current location is not visible for these views), and digging correctly in the DOM elements +for this view (very similar to the normal tree view one) will do the trick. This will also help users +to locate the feature, as it's hidden now by default and users don't think about selecting records. +The behavior will be: nothing selected > you export all (including groups). +Something or all selected: export the selection. + Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. - +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. Credits ======= @@ -41,6 +53,8 @@ Credits Contributors ------------ + * Henry Zhou (MAXodoo) + * Rodney * Simone Orsi * Lorenzo Battistini * Stefan Rijnhart diff --git a/web_export_view/__init__.py b/web_export_view/__init__.py index 9a651413..b0f26a9a 100644 --- a/web_export_view/__init__.py +++ b/web_export_view/__init__.py @@ -1,21 +1,3 @@ # -*- 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 . -# -############################################################################## + from . import controllers diff --git a/web_export_view/__manifest__.py b/web_export_view/__manifest__.py index 0e3f5cad..2281d685 100644 --- a/web_export_view/__manifest__.py +++ b/web_export_view/__manifest__.py @@ -1,40 +1,28 @@ # -*- 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 . -# -############################################################################## +# Copyright 2016 Henry Zhou (http://www.maxodoo.com) +# Copyright 2016 Rodney (http://clearcorp.cr/) +# Copyright 2012 Agile Business Group +# Copyright 2012 Domsense srl () +# Copyright 2012 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { - 'name': 'Export Current View', - 'version': '8.0.1.2.0', + 'name': 'Web Export Current View', + 'version': '10.0.1.0.0', 'category': 'Web', - 'author': "Agile Business Group,Odoo Community Association (OCA)", + 'author': 'Henry Zhou, Agile Business Group, \ + Odoo Community Association (OCA)', 'website': 'http://www.agilebg.com', 'license': 'AGPL-3', 'depends': [ 'web', ], - 'data': [ - 'view/web_export_view.xml', + "data": [ + 'views/web_export_view_view.xml', ], 'qweb': [ - 'static/src/xml/web_export_view_template.xml', + "static/src/xml/web_export_view_template.xml", ], - 'installable': False, + 'installable': True, 'auto_install': False, } diff --git a/web_export_view/controllers/__init__.py b/web_export_view/controllers/__init__.py index 9a651413..b0f26a9a 100644 --- a/web_export_view/controllers/__init__.py +++ b/web_export_view/controllers/__init__.py @@ -1,21 +1,3 @@ # -*- 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 . -# -############################################################################## + from . import controllers diff --git a/web_export_view/controllers/controllers.py b/web_export_view/controllers/controllers.py index a38eec52..090a96de 100644 --- a/web_export_view/controllers/controllers.py +++ b/web_export_view/controllers/controllers.py @@ -1,32 +1,14 @@ # -*- 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 . -# -############################################################################## -try: - import json -except ImportError: - import simplejson as json +# Copyright 2016 Henry Zhou (http://www.maxodoo.com) +# Copyright 2016 Rodney (http://clearcorp.cr/) +# Copyright 2012 Agile Business Group +# Copyright 2012 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -import openerp.http as http -from openerp.http import request -from openerp.addons.web.controllers.main import ExcelExport +import json +import odoo.http as http +from odoo.http import request +from odoo.addons.web.controllers.main import ExcelExport class ExcelExportView(ExcelExport): diff --git a/web_export_view/i18n/de.po b/web_export_view/i18n/de.po deleted file mode 100644 index d604f1d5..00000000 --- a/web_export_view/i18n/de.po +++ /dev/null @@ -1,44 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-21 11:59+0000\n" -"PO-Revision-Date: 2013-12-07 17:21+0000\n" -"Last-Translator: Nicolas JEUDY \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n" -"X-Generator: Launchpad (build 17077)\n" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7 -#, python-format -msgid "Export Current View" -msgstr "Aktuelle Liste exportieren" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9 -#, python-format -msgid "Excel" -msgstr "Excel" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81 -#, python-format -msgid "True" -msgstr "" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84 -#, python-format -msgid "False" -msgstr "" diff --git a/web_export_view/i18n/es.po b/web_export_view/i18n/es.po deleted file mode 100644 index 7f6ddbd3..00000000 --- a/web_export_view/i18n/es.po +++ /dev/null @@ -1,46 +0,0 @@ -# Spanish translation for web-addons -# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 -# This file is distributed under the same license as the web-addons package. -# FIRST AUTHOR , 2014. -# -msgid "" -msgstr "" -"Project-Id-Version: web-addons\n" -"Report-Msgid-Bugs-To: FULL NAME \n" -"POT-Creation-Date: 2013-10-21 11:59+0000\n" -"PO-Revision-Date: 2014-02-20 23:18+0000\n" -"Last-Translator: Pedro Manuel Baeza \n" -"Language-Team: Spanish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n" -"X-Generator: Launchpad (build 17077)\n" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7 -#, python-format -msgid "Export Current View" -msgstr "Exportar vista actual" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9 -#, python-format -msgid "Excel" -msgstr "Excel" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81 -#, python-format -msgid "True" -msgstr "Verdadero" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84 -#, python-format -msgid "False" -msgstr "Falso" diff --git a/web_export_view/i18n/fr.po b/web_export_view/i18n/fr.po deleted file mode 100644 index f7b83a89..00000000 --- a/web_export_view/i18n/fr.po +++ /dev/null @@ -1,44 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-21 11:59+0000\n" -"PO-Revision-Date: 2014-03-13 09:06+0000\n" -"Last-Translator: Sylvain LE GAL (GRAP) \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n" -"X-Generator: Launchpad (build 17077)\n" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7 -#, python-format -msgid "Export Current View" -msgstr "Exporter la vue courante" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9 -#, python-format -msgid "Excel" -msgstr "Excel" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81 -#, python-format -msgid "True" -msgstr "" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84 -#, python-format -msgid "False" -msgstr "" diff --git a/web_export_view/i18n/is.po b/web_export_view/i18n/is.po deleted file mode 100644 index c3d210fc..00000000 --- a/web_export_view/i18n/is.po +++ /dev/null @@ -1,46 +0,0 @@ -# Icelandic translation for web-addons -# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 -# This file is distributed under the same license as the web-addons package. -# FIRST AUTHOR , 2014. -# -msgid "" -msgstr "" -"Project-Id-Version: web-addons\n" -"Report-Msgid-Bugs-To: FULL NAME \n" -"POT-Creation-Date: 2013-10-21 11:59+0000\n" -"PO-Revision-Date: 2014-04-11 08:56+0000\n" -"Last-Translator: Sveinn í Felli \n" -"Language-Team: Icelandic \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n" -"X-Generator: Launchpad (build 17077)\n" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7 -#, python-format -msgid "Export Current View" -msgstr "Flytja út núverandi sýn" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9 -#, python-format -msgid "Excel" -msgstr "Excel" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81 -#, python-format -msgid "True" -msgstr "" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84 -#, python-format -msgid "False" -msgstr "" diff --git a/web_export_view/i18n/nl.po b/web_export_view/i18n/nl.po deleted file mode 100644 index bae9aee8..00000000 --- a/web_export_view/i18n/nl.po +++ /dev/null @@ -1,44 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-21 11:59+0000\n" -"PO-Revision-Date: 2013-12-07 17:21+0000\n" -"Last-Translator: Nicolas JEUDY \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n" -"X-Generator: Launchpad (build 17077)\n" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7 -#, python-format -msgid "Export Current View" -msgstr "Huidige lijst exporteren" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9 -#, python-format -msgid "Excel" -msgstr "Excel" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81 -#, python-format -msgid "True" -msgstr "" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84 -#, python-format -msgid "False" -msgstr "" diff --git a/web_export_view/i18n/sl.po b/web_export_view/i18n/sl.po deleted file mode 100644 index 832cf5b4..00000000 --- a/web_export_view/i18n/sl.po +++ /dev/null @@ -1,47 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# -# Matjaž Mozetič , 2015. -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-21 11:59+0000\n" -"PO-Revision-Date: 2015-04-24 08:07+0100\n" -"Last-Translator: Matjaž Mozetič \n" -"Language-Team: Slovenian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" -"Language: sl\n" -"X-Generator: Lokalize 2.0\n" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7 -#, python-format -msgid "Export Current View" -msgstr "Izvoz trenutnega pogleda" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9 -#, python-format -msgid "Excel" -msgstr "Excel" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81 -#, python-format -msgid "True" -msgstr "Pravilno" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84 -#, python-format -msgid "False" -msgstr "Nepravilno" - diff --git a/web_export_view/i18n/web_export_view.pot b/web_export_view/i18n/web_export_view.pot deleted file mode 100644 index ea6d7b6f..00000000 --- a/web_export_view/i18n/web_export_view.pot +++ /dev/null @@ -1,43 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-21 11:59+0000\n" -"PO-Revision-Date: 2013-10-21 11:59+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7 -#, python-format -msgid "Export Current View" -msgstr "" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9 -#, python-format -msgid "Excel" -msgstr "" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81 -#, python-format -msgid "True" -msgstr "" - -#. module: web_export_view -#. openerp-web -#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84 -#, python-format -msgid "False" -msgstr "" diff --git a/web_export_view/i18n/zh_CN.po b/web_export_view/i18n/zh_CN.po new file mode 100644 index 00000000..717fb78e --- /dev/null +++ b/web_export_view/i18n/zh_CN.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_export_view +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-04 02:11+0000\n" +"PO-Revision-Date: 2016-11-04 02:11+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_export_view +#. openerp-web +#: code:addons/web_export_view/static/src/xml/web_export_view_template.xml:6 +#, python-format +msgid "Export xls" +msgstr "导出 xls" + +#. module: web_export_view +#. openerp-web +#: code:addons/web_export_view/static/src/js/web_export_view.js:66 +#, python-format +msgid "False" +msgstr "否" + +#. module: web_export_view +#. openerp-web +#: code:addons/web_export_view/static/src/js/web_export_view.js:63 +#, python-format +msgid "True" +msgstr "是" + diff --git a/web_export_view/static/src/js/web_export_view.js b/web_export_view/static/src/js/web_export_view.js index 00cb047e..68be0964 100644 --- a/web_export_view/static/src/js/web_export_view.js +++ b/web_export_view/static/src/js/web_export_view.js @@ -1,38 +1,24 @@ -// @@@ 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 (instance) { +odoo.define('web_export_view', function (require) { +"use strict"; - var _t = instance.web._t, QWeb = instance.web.qweb; + var core = require('web.core'); + var Sidebar = require('web.Sidebar'); + var QWeb = core.qweb; + + var _t = core._t; + + Sidebar.include({ - instance.web.Sidebar.include({ redraw: function () { var self = this; this._super.apply(this, arguments); - if (self.getParent().ViewManager.active_view == 'list') { - 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); + if (self.getParent().ViewManager.active_view.type == 'list') { + self.$el.find('.o_dropdown').last().append(QWeb.render('WebExportTreeViewXls', {widget: self})); + self.$el.find('.export_treeview_xls').on('click', self.on_sidebar_export_treeview_xls); } }, - on_sidebar_export_view_xls: function () { + on_sidebar_export_treeview_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, @@ -51,50 +37,51 @@ openerp.web_export_view = function (instance) { return true; }); } - export_columns_keys = []; - export_columns_names = []; + var export_columns_keys = []; + var export_columns_names = []; $.each(view.visible_columns, function () { - if (this.tag == 'field') { + if (this.tag == 'field' && (this.widget === undefined || this.widget != 'handle')) { // non-fields like `_group` or buttons export_columns_keys.push(this.id); export_columns_names.push(this.string); } }); - rows = view.$el.find('.oe_list_content > tbody > tr'); - export_rows = []; + var rows = view.$el.find('.o_list_view > tbody > tr'); + var export_rows = []; $.each(rows, function () { - $row = $(this); + var $row = $(this); // find only rows with data if ($row.attr('data-id')) { - export_row = []; - checked = $row.find('th input[type=checkbox]').attr("checked"); - if (children && checked === "checked") { + var export_row = []; + var checked = $row.find('.o_list_record_selector input[type=checkbox]').is(':checked'); + if (children && checked === true) { $.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(instance.web.parse_value(text, {'type': "float"})); - } - else if (cell.classList.contains("oe_list_field_boolean")) { - var data_id = $('
' + cell.innerHTML + '
'); - if (data_id.find('input').get(0).checked) { + var $cell = $row.find('td[data-field="' + this + '"]') + var $cellcheckbox = $cell.find('.o_checkbox input[type=checkbox]'); + if ($cellcheckbox.length) { + if ($cellcheckbox.is(':checked')) { export_row.push(_t("True")); } else { export_row.push(_t("False")); } } - else if (cell.classList.contains("oe_list_field_integer")) { - var tmp2 = text; - do { - tmp = tmp2; - tmp2 = tmp.replace(instance.web._t.database.parameters.thousands_sep, ""); - } while (tmp !== tmp2); - - export_row.push(parseInt(tmp2)); - } else { - export_row.push(text.trim()); + var cell = $cell.get(0); + var text = cell.text || cell.textContent || cell.innerHTML || ""; + + if (cell.classList.contains("o_list_number")) { + var tmp2 = text; + do { + var tmp = tmp2; + tmp2 = tmp.replace(_t.database.parameters.thousands_sep, ""); + } while (tmp !== tmp2); + tmp2 = tmp.replace(_t.database.parameters.decimal_point, "."); + export_row.push(parseFloat(tmp2)); + } + else { + export_row.push(text.trim()); + } } }); export_rows.push(export_row); @@ -112,6 +99,6 @@ openerp.web_export_view = function (instance) { complete: $.unblockUI }); } - }); -}; + }); +}); diff --git a/web_export_view/static/src/xml/web_export_view_template.xml b/web_export_view/static/src/xml/web_export_view_template.xml index fbd855d9..32bd002e 100644 --- a/web_export_view/static/src/xml/web_export_view_template.xml +++ b/web_export_view/static/src/xml/web_export_view_template.xml @@ -1,12 +1,11 @@ - -
- -
    -
  • Excel
  • -
+ +
+
- \ No newline at end of file + diff --git a/web_export_view/view/web_export_view.xml b/web_export_view/view/web_export_view.xml deleted file mode 100644 index 502070f1..00000000 --- a/web_export_view/view/web_export_view.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/web_export_view/views/web_export_view_view.xml b/web_export_view/views/web_export_view_view.xml new file mode 100644 index 00000000..4787238e --- /dev/null +++ b/web_export_view/views/web_export_view_view.xml @@ -0,0 +1,9 @@ + + + + +