Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions web_excel_export_dynamic_expand/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

===============================
Web Excel Export Dynamic Expand
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0ebaf3ae34e14b004119de667f5e9923e0e3cc6a0e57349fd4b860af03a2b9c2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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/19.0/web_excel_export_dynamic_expand
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_excel_export_dynamic_expand
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

When exporting a tree view to an Excel file, you can decide if you want
to export only the main groups or the full tree, depending on if all
groups are collapsed, or there is one open.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_excel_export_dynamic_expand%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* ForgeFlow

Contributors
------------

- Arnau Cruz <arnau.cruz@forgeflow.com>

Maintainers
-----------

This module is maintained by the OCA.

.. 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 <https://github.com/OCA/web/tree/19.0/web_excel_export_dynamic_expand>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions web_excel_export_dynamic_expand/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import controllers
18 changes: 18 additions & 0 deletions web_excel_export_dynamic_expand/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2024 - ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Web Excel Export Dynamic Expand",
"summary": "Export collapsed groups or the full tree, based on its view.",
"version": "19.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"depends": ["web"],
"data": [],
"assets": {
"web.assets_backend": [
"web_excel_export_dynamic_expand/static/src/js/data_export.esm.js",
],
},
}
1 change: 1 addition & 0 deletions web_excel_export_dynamic_expand/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import excel_export
38 changes: 38 additions & 0 deletions web_excel_export_dynamic_expand/controllers/excel_export.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2024 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import json
from collections import OrderedDict

from odoo import http

from odoo.addons.web.controllers.export import ExcelExport


class CustomGroupsTreeNode(ExcelExport):
@http.route("/web/export/xlsx", type="http", auth="user")
def web_export_xlsx(self, data):
params = json.loads(data)
self.context = params.get("context", {})
response = super().web_export_xlsx(data)
return response

@property
def context(self):
return self._context

@context.setter
def context(self, value):
self._context = value

def from_group_data(self, fields, columns_headers, groups):
collapse_groups = self.context.get("collapse_groups")
if collapse_groups:
for _child_key, child_node in groups.children.items():
aggregated_values = child_node.aggregated_values
if child_node.children:
child_node.children = OrderedDict()
if child_node.data:
child_node.data = []
child_node.aggregated_values = aggregated_values
return super().from_group_data(fields, columns_headers, groups)
14 changes: 14 additions & 0 deletions web_excel_export_dynamic_expand/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 19.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 19.0\n"
"Report-Msgid-Bugs-To: \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"
3 changes: 3 additions & 0 deletions web_excel_export_dynamic_expand/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions web_excel_export_dynamic_expand/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Arnau Cruz \<arnau.cruz@forgeflow.com\>
3 changes: 3 additions & 0 deletions web_excel_export_dynamic_expand/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
When exporting a tree view to an Excel file, you can decide if you want
to export only the main groups or the full tree, depending on if all groups
are collapsed, or there is one open.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading