Skip to content

Commit

Permalink
[MIG] mis_builder: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mpascuall committed May 17, 2024
1 parent 47c1f87 commit 1e4aff3
Show file tree
Hide file tree
Showing 30 changed files with 1,488 additions and 1,480 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^mis_builder/|
^mis_builder_budget/|
^mis_builder_demo/|
# END NOT INSTALLABLE ADDONS
Expand Down
901 changes: 473 additions & 428 deletions mis_builder/README.rst

Large diffs are not rendered by default.

4 changes: 2 additions & 2 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": "16.0.5.1.9",
"version": "17.0.1.0.0",
"category": "Reporting",
"summary": """
Build 'Management Information System' Reports and Dashboards
Expand Down Expand Up @@ -38,7 +38,7 @@
],
},
"qweb": ["static/src/xml/mis_report_widget.xml"],
"installable": False,
"installable": True,
"application": True,
"license": "AGPL-3",
"development_status": "Production/Stable",
Expand Down
10 changes: 0 additions & 10 deletions mis_builder/migrations/16.0.5.0.0/end-migrate.py

This file was deleted.

29 changes: 0 additions & 29 deletions mis_builder/migrations/8.0.2.0.0/post-migration.py

This file was deleted.

20 changes: 0 additions & 20 deletions mis_builder/migrations/8.0.2.0.0/pre-migration.py

This file was deleted.

4 changes: 1 addition & 3 deletions mis_builder/models/mis_kpi_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MisKpiData(models.AbstractModel):
_name = "mis.kpi.data"
_description = "MIS Kpi Data Abtract class"

name = fields.Char(compute="_compute_name", required=False, readonly=True)
name = fields.Char(compute="_compute_name", required=False)
kpi_expression_id = fields.Many2one(
comodel_name="mis.report.kpi.expression",
required=True,
Expand All @@ -39,13 +39,11 @@ class MisKpiData(models.AbstractModel):
seq1 = fields.Integer(
related="kpi_expression_id.kpi_id.sequence",
store=True,
readonly=True,
string="KPI Sequence",
)
seq2 = fields.Integer(
related="kpi_expression_id.subkpi_id.sequence",
store=True,
readonly=True,
string="Sub-KPI Sequence",
)

Expand Down
37 changes: 18 additions & 19 deletions mis_builder/models/mis_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,12 @@ class MisReportKpi(models.Model):

_order = "sequence, id"

def name_get(self):
res = []
for rec in self:
name = f"{rec.description} ({rec.name})"
res.append((rec.id, name))
return res
_rec_names_search = ["name", "description"]

@api.model
def name_search(self, name="", args=None, operator="ilike", limit=100):
domain = args or []
domain += ["|", ("name", operator, name), ("description", operator, name)]
return self.search(domain, limit=limit).name_get()
@api.depends("description", "name")
def _compute_display_name(self):
for rec in self:
rec.display_name = f"{rec.description} ({rec.name})"

@api.constrains("name")
def _check_name(self):
Expand Down Expand Up @@ -292,7 +286,7 @@ class MisReportKpiExpression(models.Model):
_description = "MIS Report KPI Expression"
_order = "sequence, name, id"

sequence = fields.Integer(related="subkpi_id.sequence", store=True, readonly=True)
sequence = fields.Integer(related="subkpi_id.sequence", store=True)
name = fields.Char(string="Expression")
kpi_id = fields.Many2one("mis.report.kpi", required=True, ondelete="cascade")
# TODO FIXME set readonly=True when onchange('subkpi_ids') below works
Expand All @@ -306,8 +300,14 @@ class MisReportKpiExpression(models.Model):
)
]

def name_get(self):
res = []
@api.depends(
"kpi_id.description",
"subkpi_id.description",
"kpi_id.name",
"subkpi_id.name",
"kpi_id.display_name",
)
def _compute_display_name(self):
for rec in self:
kpi = rec.kpi_id
subkpi = rec.subkpi_id
Expand All @@ -317,14 +317,13 @@ def name_get(self):
)
else:
name = rec.kpi_id.display_name
res.append((rec.id, name))
return res
rec.display_name = name

@api.model
def name_search(self, name="", args=None, operator="ilike", limit=100):
def _name_search(self, name, domain=None, operator="ilike", limit=None, order=None):
# TODO maybe implement negative search operators, although
# there is not really a use case for that
domain = args or []
domain = domain or []
splitted_name = name.split(".", 2)
name_search_domain = []
if "." in name:
Expand Down Expand Up @@ -354,7 +353,7 @@ def name_search(self, name="", args=None, operator="ilike", limit=100):
]
)
domain = osv_expression.AND([domain, name_search_domain])
return self.search(domain, limit=limit).name_get()
return self._search(domain, limit=limit, order=order)


class MisReportQuery(models.Model):
Expand Down
11 changes: 4 additions & 7 deletions mis_builder/models/mis_report_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def _compute_pivot_date(self):
_description = "MIS Report Instance"

name = fields.Char(required=True, translate=True)
description = fields.Char(related="report_id.description", readonly=True)
description = fields.Char(related="report_id.description")
date = fields.Date(
string="Base date", help="Report base date " "(leave empty to use current date)"
)
Expand Down Expand Up @@ -539,12 +539,10 @@ def _compute_pivot_date(self):
temporary = fields.Boolean(default=False)
source_aml_model_id = fields.Many2one(
related="report_id.move_lines_source",
readonly=True,
)
source_aml_model_name = fields.Char(
related="source_aml_model_id.model",
related_sudo=True,
readonly=True,
)
analytic_domain = fields.Text(
default="[]",
Expand Down Expand Up @@ -885,11 +883,10 @@ def _get_drilldown_views_and_orders(self):
@api.model
def _get_drilldown_model_views(self, model_name):
self.ensure_one()
types = self.env["ir.ui.view"]._read_group(
[("model", "=", model_name)], ["type"], ["type"]
)
views_records = self.env["ir.ui.view"].search([("model", "=", model_name)])
views_records = set(views_records.mapped("type"))
views_order = self._get_drilldown_views_and_orders()
views = {type["type"] for type in types if type["type"] in views_order}
views = {view_type for view_type in views_records if view_type in views_order}
return sorted(list(views), key=lambda x: views_order[x])

def drilldown(self, arg):
Expand Down
29 changes: 29 additions & 0 deletions mis_builder/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- Stéphane Bidoul \<<[email protected]>\>
- Laetitia Gangloff \<<[email protected]>\>
- Adrien Peiffer \<<[email protected]>\>
- Alexis de Lattre \<<[email protected]>\>
- Alexandre Fayolle \<<[email protected]>\>
- Jordi Ballester \<<[email protected]>\>
- Thomas Binsfeld \<<[email protected]>\>
- Giovanni Capalbo \<<[email protected]>\>
- Marco Calcagni \<<[email protected]>\>
- Sébastien Beau \<<[email protected]>\>
- Laurent Mignon \<<[email protected]>\>
- Luc De Meyer \<<[email protected]>\>
- Benjamin Willig \<<[email protected]>\>
- Martronic SA \<<[email protected]>\>
- nicomacr \<<[email protected]>\>
- Juan Jose Scarafia \<<[email protected]>\>
- Richard deMeester \<<[email protected]>\>
- Eric Caudal \<<[email protected]>\>
- Andrea Stirpe \<<[email protected]>\>
- Maxence Groine \<<[email protected]>\>
- Arnaud Pineux \<<[email protected]>\>
- Ernesto Tejeda \<<[email protected]>\>
- Pedro M. Baeza \<<[email protected]>\>
- Alexey Pelykh \<<[email protected]>\>
- Jairo Llopis (<https://www.moduon.team/>)
- Dzung Tran \<<[email protected]>\>
- Hoang Diep \<<[email protected]>\>
- Miquel Pascual \<<[email protected]>\>
- Antoni Marroig \<<[email protected]>\>
27 changes: 0 additions & 27 deletions mis_builder/readme/CONTRIBUTORS.rst

This file was deleted.

5 changes: 5 additions & 0 deletions mis_builder/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module allows you to build Management Information Systems
dashboards. Such style of reports presents KPI in rows and time periods
in columns. Reports mainly fetch data from account moves, but can also
combine data coming from arbitrary Odoo models. Reports can be exported
to PDF, Excel and they can be added to Odoo dashboards.
5 changes: 0 additions & 5 deletions mis_builder/readme/DESCRIPTION.rst

This file was deleted.

7 changes: 7 additions & 0 deletions mis_builder/readme/DEVELOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
A typical extension is to provide a mechanism to filter reports on
analytic dimensions or operational units. To implement this, you can
override \_get_additional_move_line_filter and \_get_additional_filter
to further filter move lines or queries based on a user selection. A
typical use case could be to add an analytic account field on
mis.report.instance, or even on mis.report.instance.period if you want
different columns to show different analytic accounts.
6 changes: 0 additions & 6 deletions mis_builder/readme/DEVELOP.rst

This file was deleted.

Loading

0 comments on commit 1e4aff3

Please sign in to comment.