Skip to content
Closed
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
6 changes: 1 addition & 5 deletions mis_builder/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

===========
MIS Builder
===========
Expand All @@ -17,7 +13,7 @@ MIS Builder
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
.. |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-lightgray.png?logo=github
Expand Down
4 changes: 1 addition & 3 deletions mis_builder/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "MIS Builder",
"version": "18.0.1.7.3",
"version": "18.0.2.0.0",
"category": "Reporting",
"summary": """
Build 'Management Information System' Reports and Dashboards
Expand All @@ -13,7 +13,6 @@
"depends": [
"account",
"board",
"report_xlsx", # OCA/reporting-engine
"date_range", # OCA/server-ux
],
"data": [
Expand All @@ -26,7 +25,6 @@
"security/ir.model.access.csv",
"security/mis_builder_security.xml",
"report/mis_report_instance_qweb.xml",
"report/mis_report_instance_xlsx.xml",
],
"assets": {
"web.assets_backend": [
Expand Down
36 changes: 36 additions & 0 deletions mis_builder/migrations/18.0.2.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import logging

from openupgradelib import openupgrade

_logger = logging.getLogger(__name__)

xmlid_renames = [
("mis_builder.xls_export", "mis_builder_report_xlsx.xls_export"),
]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not done automatically?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the original database is :

 id  |                    name                     |       type        
-----+---------------------------------------------+-------------------
 288 | {"en_US": "MIS report instance XLS report"} | ir.actions.report

With that script:

  • during update

2025-09-25 09:25:36,222 71906 DEBUG mis_builder_v1 OpenUpgrade: 1 rows affected after 0:00:00.000510 running UPDATE ir_model_data SET module = 'mis_builder_report_xlsx', name = 'xls_export' WHERE module = 'mis_builder' and name = 'xls_export'

  • in database, after the update
 id  |                    name                     |       type        
-----+---------------------------------------------+-------------------
 288 | {"en_US": "MIS report instance XLS report"} | ir.actions.report

Without that script

  • during update

2025-09-25 09:30:18,601 72300 INFO mis_builder_v2 odoo.addons.base.models.ir_model: Deleting 288@ir.actions.report (mis_builder.xls_export)

  • in database, after the update

 id  |                    name                     |       type        
-----+---------------------------------------------+-------------------
 289 | {"en_US": "MIS report instance XLS report"} | ir.actions.report

So it can be usefull if this action was referenced in some action_id field.
(It's maybe quite theoritical, but it's an OpenUpgrade good practice)



@openupgrade.migrate()
def migrate(env, version):
env.cr.execute("""
SELECT count(*)
FROM ir_module_module
WHERE name = 'mis_builder_report_xlsx'""")
if env.cr.fetchone()[0] == 0:
_logger.error(
"Unable to found the module mis_builder_report_xlsx.\n"
" The module mis_builder has been refactored"
" and splitted into another module named"
" 'mis_builder_report_xlsx'."
" If you don't get this module in your addons path"
" the feature to export in XLSX will be lost.\n"
" More information:"
" https://github.com/OCA/mis-builder/pull/728"
)
openupgrade.logged_query(
env.cr,
"""
UPDATE ir_module_module
SET state='to upgrade'
WHERE name = 'mis_builder_report_xlsx' AND state='uninstalled'""",
)
openupgrade.rename_xmlids(env.cr, xmlid_renames)
6 changes: 0 additions & 6 deletions mis_builder/models/mis_report_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,6 @@ def print_pdf(self):
.report_action(self, data=dict(dummy=True)) # required to propagate context
)

def export_xls(self):
self.ensure_one()
return self.env.ref("mis_builder.xls_export").report_action(
self, data=dict(dummy=True)
) # required to propagate context

def display_settings(self):
assert len(self.ids) <= 1
view_id = self.env.ref("mis_builder.mis_report_instance_view_form")
Expand Down
40 changes: 0 additions & 40 deletions mis_builder/models/mis_report_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,6 @@ def check_positive_val(self):
("xx-large", "xx-large"),
]

_font_size_to_xlsx_size = {
"medium": 11,
"xx-small": 5,
"x-small": 7,
"small": 9,
"large": 13,
"x-large": 15,
"xx-large": 17,
}

# style name
name = fields.Char(string="Style name", required=True)

Expand Down Expand Up @@ -309,36 +299,6 @@ def compare_and_render(
delta_r = self.render(lang, delta_style, delta_type, delta, sign="+")
return delta, delta_r, delta_style, delta_type

@api.model
def to_xlsx_style(self, var_type, props, no_indent=False):
xlsx_attributes = [
("italic", props.font_style == "italic"),
("bold", props.font_weight == "bold"),
("font_size", self._font_size_to_xlsx_size.get(props.font_size, 11)),
("font_color", props.color),
("bg_color", props.background_color),
]
if var_type == TYPE_NUM:
num_format = "#,##0"
if props.dp:
num_format += "."
num_format += "0" * props.dp
if props.prefix:
num_format = f'"{props.prefix} "{num_format}'
if props.suffix:
num_format = f'{num_format}" {props.suffix}"'
xlsx_attributes.append(("num_format", num_format))
elif var_type == TYPE_PCT:
num_format = "0"
if props.dp:
num_format += "."
num_format += "0" * props.dp
num_format += "%"
xlsx_attributes.append(("num_format", num_format))
if props.indent_level is not None and not no_indent:
xlsx_attributes.append(("indent", props.indent_level))
return dict([a for a in xlsx_attributes if a[1] is not None])

@api.model
def to_css_style(self, props, no_indent=False):
css_attributes = [
Expand Down
1 change: 0 additions & 1 deletion mis_builder/report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import mis_report_instance_qweb
from . import mis_report_instance_xlsx
Loading
Loading