Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] mis_builder_wizard_export_xlsx: init #55

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
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
88 changes: 88 additions & 0 deletions mis_builder_wizard_export_xlsx/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
==============================
Mis Builder Wizard Export Xlsx
==============================

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

.. |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%2Fmis--builder--contrib-lightgray.png?logo=github
:target: https://github.com/OCA/mis-builder-contrib/tree/16.0/mis_builder_wizard_export_xlsx
:alt: OCA/mis-builder-contrib
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/mis-builder-contrib-16-0/mis-builder-contrib-16-0-mis_builder_wizard_export_xlsx
: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/mis-builder-contrib&target_branch=16.0
:alt: Try me on Runboat

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

This modules allows user to add some options when exporting some MIS
reports to xlsx:

- Generate multiple reports as sheets in one xlsx.
- Selecting custom pivot dates for each report.
- Computing one report for multiple companies but having one sheet per
company as if we executed multiple times the export.

**Table of contents**

.. contents::
:local:

Usage
=====

Action 'Custom Export XLS' in ``Accounting>Reporting>MIS Reports`` to
open the wizard to export to xlsx.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/mis-builder-contrib/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/mis-builder-contrib/issues/new?body=module:%20mis_builder_wizard_export_xlsx%0Aversion:%2016.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
-------

* ACSONE SA/NV

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

- Zina Rasoamanana [email protected] (https://www.acsone.eu/)

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/mis-builder-contrib <https://github.com/OCA/mis-builder-contrib/tree/16.0/mis_builder_wizard_export_xlsx>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions mis_builder_wizard_export_xlsx/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
21 changes: 21 additions & 0 deletions mis_builder_wizard_export_xlsx/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Mis Builder Wizard Export Xlsx",
"summary": """
Wizard to select various options when exporting a mis report as xlsx""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/mis-builder-contrib",
"depends": [
"mis_builder",
],
"data": [
"security/mis_builder_custom_export_xls_wizard.xml",
"security/mis_builder_custom_export_xls_wizard_line.xml",
"wizards/mis_builder_custom_export_xls_wizard.xml",
],
"demo": [],
}
2 changes: 2 additions & 0 deletions mis_builder_wizard_export_xlsx/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import mis_report_instance
from . import report_mis_builder_mis_report_instance_xlsx
27 changes: 27 additions & 0 deletions mis_builder_wizard_export_xlsx/models/mis_report_instance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class MisReportInstance(models.Model):

_inherit = "mis.report.instance"

def open_wizard_custom_export_xls(self):
return self.env["ir.actions.act_window"]._for_xml_id(

Check warning on line 12 in mis_builder_wizard_export_xlsx/models/mis_report_instance.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/mis_report_instance.py#L12

Added line #L12 was not covered by tests
"mis_builder_wizard_export_xlsx.mis_builder_custom_export_xls_wizard_act_window"
)

def _compute_pivot_date(self):
ret = super()._compute_pivot_date()
report_id_by_pivot_date = self.env.context.get(

Check warning on line 18 in mis_builder_wizard_export_xlsx/models/mis_report_instance.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/mis_report_instance.py#L17-L18

Added lines #L17 - L18 were not covered by tests
"mis_builder_xls_report_id_by_pivot_date"
)
if report_id_by_pivot_date:
for rec in self:
pivot_date = report_id_by_pivot_date.get(str(rec.id))

Check warning on line 23 in mis_builder_wizard_export_xlsx/models/mis_report_instance.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/mis_report_instance.py#L23

Added line #L23 was not covered by tests
if pivot_date:
rec.pivot_date = pivot_date

Check warning on line 25 in mis_builder_wizard_export_xlsx/models/mis_report_instance.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/mis_report_instance.py#L25

Added line #L25 was not covered by tests

return ret

Check warning on line 27 in mis_builder_wizard_export_xlsx/models/mis_report_instance.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/mis_report_instance.py#L27

Added line #L27 was not covered by tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class MisBuilderXlsx(models.AbstractModel):

_inherit = "report.mis_builder.mis_report_instance_xlsx"

def generate_xlsx_report(self, workbook, data, objects):
company_ids = self.env.context.get("mis_builder_xls_custom_company_ids")

Check warning on line 12 in mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py#L12

Added line #L12 was not covered by tests
if company_ids:
if self.env.context.get("mis_builder_xls_company_by_company"):
for company_id in company_ids:
res = super().generate_xlsx_report(

Check warning on line 16 in mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py#L16

Added line #L16 was not covered by tests
workbook,
data,
objects.with_context(**{"allowed_company_ids": [company_id]}),
)
else:
res = super().generate_xlsx_report(

Check warning on line 22 in mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py#L22

Added line #L22 was not covered by tests
workbook,
data,
objects.with_context(**{"allowed_company_ids": company_ids}),
)
else:
res = super().generate_xlsx_report(workbook, data, objects)

Check warning on line 28 in mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py#L28

Added line #L28 was not covered by tests

return res

Check warning on line 30 in mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_wizard_export_xlsx/models/report_mis_builder_mis_report_instance_xlsx.py#L30

Added line #L30 was not covered by tests
1 change: 1 addition & 0 deletions mis_builder_wizard_export_xlsx/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Zina Rasoamanana <[email protected]> (https://www.acsone.eu/)
4 changes: 4 additions & 0 deletions mis_builder_wizard_export_xlsx/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This modules allows user to add some options when exporting some MIS reports to xlsx:
- Generate multiple reports as sheets in one xlsx.
- Selecting custom pivot dates for each report.
- Computing one report for multiple companies but having one sheet per company as if we executed multiple times the export.
1 change: 1 addition & 0 deletions mis_builder_wizard_export_xlsx/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Action 'Custom Export XLS' in `Accounting>Reporting>MIS Reports` to open the wizard to export to xlsx.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2025 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

<record model="ir.model.access" id="mis_builder_custom_export_xls_wizard_access">
<field name="name">mis.builder.custom.export.xls.wizard access</field>
<field name="model_id" ref="model_mis_builder_custom_export_xls_wizard" />
<field name="group_id" ref="base.group_user" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="1" />
<field name="perm_write" eval="1" />
<field name="perm_unlink" eval="1" />
</record>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2025 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

<record
model="ir.model.access"
id="mis_builder_custom_export_xls_wizard_line_access"
>
<field name="name">mis.builder.custom.export.xls.wizard.line access</field>
<field name="model_id" ref="model_mis_builder_custom_export_xls_wizard_line" />
<field name="group_id" ref="base.group_user" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="1" />
<field name="perm_write" eval="1" />
<field name="perm_unlink" eval="1" />
</record>

</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading