From 2aa90d240d4187423b79db05e8a4de372e545db0 Mon Sep 17 00:00:00 2001 From: Valtteri Lattu Date: Wed, 3 Apr 2019 10:50:13 +0300 Subject: [PATCH] [MIG] web_export_view: Migration to 12.0 --- web_export_view/README.rst | 101 ++- web_export_view/__init__.py | 2 - web_export_view/__manifest__.py | 2 +- web_export_view/readme/CONFIGURE.rst | 2 + web_export_view/readme/CONTRIBUTORS.rst | 6 +- web_export_view/static/description/index.html | 653 ++++++++++++++++++ .../static/src/js/web_export_view.js | 10 +- 7 files changed, 736 insertions(+), 40 deletions(-) create mode 100644 web_export_view/readme/CONFIGURE.rst create mode 100644 web_export_view/static/description/index.html diff --git a/web_export_view/README.rst b/web_export_view/README.rst index b87afbf2..e9872121 100644 --- a/web_export_view/README.rst +++ b/web_export_view/README.rst @@ -1,8 +1,29 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License - -Export Current View -=================== +======================= +Web Export Current View +======================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/12.0/web_export_view + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_export_view + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| 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 @@ -16,6 +37,11 @@ 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. +**Table of contents** + +.. contents:: + :local: + Configuration ============= @@ -29,11 +55,10 @@ After you installed it, you'll find an additional link 'Export current view' 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 / Roadmap +====================== -Known Issues -============ - -Pedro M. Baeza (pedro.baeza@gmail.com): +Pedro M. Baeza (pedro.baeza@tecnativa.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, @@ -43,39 +68,55 @@ to locate the feature, as it's hidden now by default and users don't think about 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. +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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Henry Zhou +* Agile Business Group + Contributors ------------- +~~~~~~~~~~~~ - * Henry Zhou (MAXodoo) - * Rodney - * Simone Orsi - * Lorenzo Battistini - * Stefan Rijnhart - * Leonardo Pistone - * Jose Maria Bernet - * David Vidal +* Henry Zhou (MAXodoo) +* Rodney +* Simone Orsi +* Lorenzo Battistini +* Stefan Rijnhart +* Leonardo Pistone +* Jose Maria Bernet +* Alexandre Díaz +* Valtteri Lattu +* `Tecnativa `_: -Maintainer ----------- + * David Vidal + * Ernesto Tejeda -.. image:: http://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: http://odoo-community.org +Maintainers +~~~~~~~~~~~ This module is maintained by the OCA. -OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. -To contribute to this module, please visit http://odoo-community.org. +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_export_view/__init__.py b/web_export_view/__init__.py index b0f26a9a..e046e49f 100644 --- a/web_export_view/__init__.py +++ b/web_export_view/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import controllers diff --git a/web_export_view/__manifest__.py b/web_export_view/__manifest__.py index 85541d8d..bd86c043 100644 --- a/web_export_view/__manifest__.py +++ b/web_export_view/__manifest__.py @@ -8,7 +8,7 @@ { 'name': 'Web Export Current View', - 'version': '11.0.2.0.0', + 'version': '12.0.1.0.0', 'category': 'Web', 'author': 'Henry Zhou, Agile Business Group, \ Odoo Community Association (OCA)', diff --git a/web_export_view/readme/CONFIGURE.rst b/web_export_view/readme/CONFIGURE.rst new file mode 100644 index 00000000..3ae2e649 --- /dev/null +++ b/web_export_view/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +If we wanted to disallow users to use the features provided by this module, we +can add them to the group *Disallow Export View Data to Excel*. \ No newline at end of file diff --git a/web_export_view/readme/CONTRIBUTORS.rst b/web_export_view/readme/CONTRIBUTORS.rst index 67e4e410..3b71ec42 100644 --- a/web_export_view/readme/CONTRIBUTORS.rst +++ b/web_export_view/readme/CONTRIBUTORS.rst @@ -5,5 +5,9 @@ * Stefan Rijnhart * Leonardo Pistone * Jose Maria Bernet -* David Vidal * Alexandre Díaz +* Valtteri Lattu +* `Tecnativa `_: + + * David Vidal + * Ernesto Tejeda diff --git a/web_export_view/static/description/index.html b/web_export_view/static/description/index.html new file mode 100644 index 00000000..e823ea02 --- /dev/null +++ b/web_export_view/static/description/index.html @@ -0,0 +1,653 @@ + + + + + + + Web Export Current View + + + +
+

Web Export Current View

+ + +

Beta + License: AGPL-3 + OCA/web + Translate me on Weblate + Try me on Runbot +

+

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 + having to configure it again.

+

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.

+

Table of contents

+ +
+

Configuration

+

If we wanted to disallow users to use the features provided by this + module, we + can add them to the group Disallow Export View Data to + Excel.

+
+
+

Usage

+

After you installed it, you’ll find an additional link ‘Export + current view’ + 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 / Roadmap

+

Pedro M. Baeza (pedro.baeza@tecnativa.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. +

+

Do not contact contributors directly about support or help with + technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Henry Zhou
  • +
  • Agile Business Group
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit + organization whose + mission is to support the collaborative development of Odoo + features and + promote its widespread use.

+

This module is part of the OCA/web + project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. +

+
+
+
+ + 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 47e82135..71cc034f 100644 --- a/web_export_view/static/src/js/web_export_view.js +++ b/web_export_view/static/src/js/web_export_view.js @@ -19,9 +19,10 @@ odoo.define('web_export_view', function (require) { session.user_has_group( 'web_export_view.group_disallow_export_view_data_excel') .then(function (has_group) { - if (!has_group) { + var export_btn = self.$el.find('.export_treeview_xls'); + if (!has_group && !export_btn.length) { self.$el.find('.o_dropdown') - .last().append(QWeb.render( + .parent().append(QWeb.render( 'WebExportTreeViewXls', {widget: self})); self.$el.find('.export_treeview_xls').on('click', self.on_sidebar_export_treeview_xls); @@ -54,17 +55,14 @@ odoo.define('web_export_view', function (require) { var export_columns_names = []; var column_index = 0; var column_header_selector = ''; - var isGrouped = view.renderer.state.groupedBy.length > 0; $.each(view.renderer.columns, function () { if (this.tag === 'field' && (this.attrs.widget === undefined || this.attrs.widget !== 'handle')) { export_columns_keys.push(column_index); - var css_selector_index = isGrouped - ? column_index+1 : column_index; column_header_selector = '.o_list_view > thead > tr> ' + 'th:not([class*="o_list_record_selector"]):eq(' + - css_selector_index + ')'; + column_index + ')'; export_columns_names.push( view.$el.find(column_header_selector)[0].textContent); }