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
7 changes: 7 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ target-version = "py310"
fix = true

[lint]
# Pin the base rule set instead of inheriting ruff's default. The 20.0 skeleton
# bumps ruff v0.13.0 -> v0.16.8, and 0.16.8 ships a much wider default; since
# this file only ever said `extend-select`, that drift silently switched on
# whole families the repo never chose (BLE, C4, DTZ, PIE, RUF, SIM). These four
# are ruff's classic default, so `select` plus the `extend-select` below
# reproduces exactly what v0.13.0 enforced on 19.0.
select = ["E4", "E7", "E9", "F"]
extend-select = [
"B",
"C90",
Expand Down
10 changes: 5 additions & 5 deletions mis_builder/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ MIS Builder
: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
:target: https://github.com/OCA/mis-builder/tree/19.0/mis_builder
:target: https://github.com/OCA/mis-builder/tree/20.0/mis_builder
:alt: OCA/mis-builder
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/mis-builder-19-0/mis-builder-19-0-mis_builder
:target: https://translation.odoo-community.org/projects/mis-builder-20-0/mis-builder-20-0-mis_builder
: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&target_branch=19.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/mis-builder&target_branch=20.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -731,7 +731,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/mis-builder/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/issues/new?body=module:%20mis_builder%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/mis-builder/issues/new?body=module:%20mis_builder%0Aversion:%2020.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.

Expand Down Expand Up @@ -798,6 +798,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sbidoul|

This module is part of the `OCA/mis-builder <https://github.com/OCA/mis-builder/tree/19.0/mis_builder>`_ project on GitHub.
This module is part of the `OCA/mis-builder <https://github.com/OCA/mis-builder/tree/20.0/mis_builder>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
12 changes: 4 additions & 8 deletions mis_builder/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

{
"name": "MIS Builder",
"version": "19.0.1.2.1",
"version": "20.0.1.0.0",
"category": "Reporting",
"summary": """
Build 'Management Information System' Reports and Dashboards
""",
"summary": "Build 'Management Information System' Reports and Dashboards",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/mis-builder",
"depends": [
Expand All @@ -23,10 +21,9 @@
"views/mis_report_instance.xml",
"views/mis_report_style.xml",
"datas/ir_cron.xml",
"security/ir.model.access.csv",
"security/mis_builder_security.xml",
"report/mis_report_instance_qweb.xml",
"report/mis_report_instance_xlsx.xml",
"security/ir.access.csv",
],
"assets": {
"web.assets_backend": [
Expand All @@ -40,8 +37,7 @@
"mis_builder/static/src/scss/report.scss",
],
},
"qweb": ["static/src/xml/mis_report_widget.xml"],
"installable": False,
"installable": True,
"application": True,
"license": "AGPL-3",
"development_status": "Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion mis_builder/datas/ir_cron.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<odoo noupdate="1">
<record id="ir_cron_vacuum_temp_reports" model="ir.cron">
<field name="name">Vacuum temporary reports</field>
<field name="interval_number">4</field>
<field name="interval_number" eval="4" />
<field name="interval_type">hours</field>
<field name="model_id" ref="model_mis_report_instance" />
<field name="code">model._vacuum_report()</field>
Expand Down
4 changes: 2 additions & 2 deletions mis_builder/models/aep.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ def get_aml_domain_for_expr(self, expr, date_from, date_to, account_id=None):
else:
continue
if field == "crd":
aml_domain.append(("credit", "<>", 0.0))
aml_domain.append(("credit", "!=", 0.0))
elif field == "deb":
aml_domain.append(("debit", "<>", 0.0))
aml_domain.append(("debit", "!=", 0.0))
elif fld_name:
aml_domain.append((fld_name, "!=", False))
aml_domains.append(aml_domain)
Expand Down
2 changes: 1 addition & 1 deletion mis_builder/models/data_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, name, msg):
self.msg = msg

def __repr__(self):
return f"{self.__class__.__name__}({repr(self.name)})"
return f"{self.__class__.__name__}({self.name!r})"


class NameDataError(DataError):
Expand Down
2 changes: 1 addition & 1 deletion mis_builder/models/kpimatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_cell_for_row(self, row):
return cell_tuple[self.index]


class KpiMatrixCell: # noqa: B903 (immutable data class)
class KpiMatrixCell:
def __init__(
self,
row,
Expand Down
30 changes: 22 additions & 8 deletions mis_builder/models/mis_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import re
import time
from collections import defaultdict
from zoneinfo import ZoneInfo

import dateutil
import pytz

from odoo import api, fields, models
from odoo.exceptions import UserError, ValidationError
Expand Down Expand Up @@ -56,10 +56,12 @@ def __init__(self, **kwargs):

def _utc_midnight(d, tz_name, add_day=0):
d = fields.Datetime.from_string(d) + datetime.timedelta(days=add_day)
utc_tz = pytz.timezone("UTC")
context_tz = pytz.timezone(tz_name)
local_timestamp = context_tz.localize(d, is_dst=False)
return fields.Datetime.to_string(local_timestamp.astimezone(utc_tz))
# pytz is rejected by .pylintrc-mandatory's deprecated-modules and is no
# longer in Odoo's own requirements.txt. pytz's localize(..., is_dst=False)
# resolved an ambiguous local time (the DST fall-back hour) to the standard
# -time reading; zoneinfo spells that fold=1.
local_timestamp = d.replace(tzinfo=ZoneInfo(tz_name), fold=1)
return fields.Datetime.to_string(local_timestamp.astimezone(datetime.timezone.utc))


def _python_var(var_str):
Expand All @@ -84,7 +86,11 @@ class MisReportKpi(models.Model):
_name = "mis.report.kpi"
_description = "MIS Report KPI"

name = fields.Char(required=True)
# copy=True is explicit on purpose: 20.0 gives any Char field *named*
# `name` a "(copy)" suffix on duplication unless copy is declared
# (orm/fields_textual.py:529-533), and this one has to stay a valid
# python identifier -- see _check_name below.
name = fields.Char(required=True, copy=True)
description = fields.Char(required=True, translate=True)
multi = fields.Boolean()
expression = fields.Char(
Expand Down Expand Up @@ -254,7 +260,11 @@ class MisReportSubkpi(models.Model):
report_id = fields.Many2one(
comodel_name="mis.report", required=True, ondelete="cascade"
)
name = fields.Char(required=True)
# copy=True is explicit on purpose: 20.0 gives any Char field *named*
# `name` a "(copy)" suffix on duplication unless copy is declared
# (orm/fields_textual.py:529-533), and this one has to stay a valid
# python identifier -- see _check_name below.
name = fields.Char(required=True, copy=True)
description = fields.Char(required=True, translate=True)
expression_ids = fields.One2many("mis.report.kpi.expression", "subkpi_id")

Expand Down Expand Up @@ -351,7 +361,11 @@ def _compute_field_names(self):
field_names = [field.name for field in record.field_ids]
record.field_names = ", ".join(field_names)

name = fields.Char(required=True)
# copy=True is explicit on purpose: 20.0 gives any Char field *named*
# `name` a "(copy)" suffix on duplication unless copy is declared
# (orm/fields_textual.py:529-533), and this one has to stay a valid
# python identifier -- see _check_name below.
name = fields.Char(required=True, copy=True)
model_id = fields.Many2one("ir.model", required=True, ondelete="cascade")
field_ids = fields.Many2many(
"ir.model.fields", required=True, string="Fields to fetch"
Expand Down
10 changes: 2 additions & 8 deletions mis_builder/models/mis_report_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,11 +854,7 @@ def _add_column_cmpcol(self, aep, kpi_matrix, period, label, description):
)

def _add_column(self, aep, kpi_matrix, period, label, description):
if period.source == SRC_ACTUALS:
return self._add_column_move_lines(
aep, kpi_matrix, period, label, description
)
elif period.source == SRC_ACTUALS_ALT:
if period.source == SRC_ACTUALS or period.source == SRC_ACTUALS_ALT:
return self._add_column_move_lines(
aep, kpi_matrix, period, label, description
)
Expand All @@ -878,9 +874,7 @@ def _compute_matrix(self):
kpi_matrix = self.report_id.prepare_kpi_matrix(self.query_company_ids)
for period in self.period_ids:
description = None
if period.mode == MODE_NONE:
pass
elif not self.display_columns_description:
if period.mode == MODE_NONE or not self.display_columns_description:
pass
elif period.date_from == period.date_to and period.date_from:
description = self._format_date(period.date_from)
Expand Down
13 changes: 7 additions & 6 deletions mis_builder/models/mis_safe_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

import traceback

from odoo.tools.safe_eval import (
_BUILTINS,
_SAFE_OPCODES,
assert_valid_codeobj,
compile_codeobj,
)
from odoo.tools.safe_eval import _BUILTINS, _SAFE_OPCODES, assert_valid_codeobj

# 20.0 split odoo/tools/safe_eval.py into a package. compile_codeobj is still
# there (safe_eval/evaluation.py) but is absent from that module's __all__, so
# the package's `from .evaluation import *` does not re-export it -- importing
# it from odoo.tools.safe_eval raises ImportError. Reach into the submodule.
from odoo.tools.safe_eval.evaluation import compile_codeobj

from .data_error import DataError, NameDataError

Expand Down
13 changes: 7 additions & 6 deletions mis_builder/models/prorata_read_group_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@ def _read_group(
for domain_item in domain:
if isinstance(domain_item, list | tuple):
field, op, value = domain_item
if field == "date" and op == ">=":
if field == "date" and op == ">=" or field == "date_to" and op == ">=":
date_from = value
elif field == "date_to" and op == ">=":
date_from = value
elif field == "date" and op == "<=":
date_to = value
elif field == "date_from" and op == "<=":
elif (
field == "date"
and op == "<="
or field == "date_from"
and op == "<="
):
date_to = value
if (
date_from is not None
Expand Down
2 changes: 1 addition & 1 deletion mis_builder/report/mis_report_instance_qweb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
t-out="cell and cell.val_rendered or ''"
/>
<span
class="oe_mis_builder_footnote"
t-if="cell"
class="oe_mis_builder_footnote"
>
<t
t-out="notes.get(cell.cell_id,{}).get('sequence','')"
Expand Down
3 changes: 1 addition & 2 deletions mis_builder/report/mis_report_instance_xlsx.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
<field name="type">ir.actions.report</field>
<field name="report_name">mis_builder.mis_report_instance_xlsx</field>
<field name="report_type">xlsx</field>
<field name="report_file">mis_report_instance</field>
</record>

<record model="ir.actions.server" id="mis_builder_print_xls_report">
<record id="mis_builder_print_xls_report" model="ir.actions.server">
<field name="name">Export XLS</field>
<field name="model_id" ref="mis_builder.model_mis_report_instance" />
<field name="binding_model_id" ref="mis_builder.model_mis_report_instance" />
Expand Down
25 changes: 25 additions & 0 deletions mis_builder/security/ir.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
id,name,model_id,group_id/id,operation,domain
manage_mis_report_kpi,manage_mis_report_kpi,mis.report.kpi,account.group_account_manager,crud,
access_mis_report_kpi,access_mis_report_kpi,mis.report.kpi,base.group_user,r,
manage_mis_report_query,manage_mis_report_query,mis.report.query,account.group_account_manager,crud,
access_mis_report_query,access_mis_report_query,mis.report.query,base.group_user,r,
manage_mis_report,manage_mis_report,mis.report,account.group_account_manager,crud,
access_mis_report,access_mis_report,mis.report,base.group_user,r,
manage_mis_report_instance_period,manage_mis_report_instance_period,mis.report.instance.period,account.group_account_manager,crud,
access_mis_report_instance_period,access_mis_report_instance_period,mis.report.instance.period,base.group_user,r,
manage_mis_report_instance_period_sum,manage_mis_report_instance_period_sum,mis.report.instance.period.sum,account.group_account_manager,crud,
access_mis_report_instance_period_sum,access_mis_report_instance_period_sum,mis.report.instance.period.sum,base.group_user,r,
manage_mis_report_instance,manage_mis_report_instance,mis.report.instance,account.group_account_manager,crud,
access_mis_report_instance,access_mis_report_instance,mis.report.instance,base.group_user,r,
mis_builder_multi_company_rule,Mis Report Instance multi company,mis.report.instance,,crud,"['|',('company_id','=',False),('company_id','in',company_ids), '|', ('company_ids', '=', False), ('company_ids', 'in', company_ids)]"
manage_mis_report_subkpi,access_mis_report_subkpi,mis.report.subkpi,account.group_account_manager,crud,
access_mis_report_subkpi,access_mis_report_subkpi,mis.report.subkpi,base.group_user,r,
manage_mis_report_kpi_expression,access_mis_report_kpi_expression,mis.report.kpi.expression,account.group_account_manager,crud,
access_mis_report_kpi_expression,access_mis_report_kpi_expression,mis.report.kpi.expression,base.group_user,r,
manage_mis_report_subreport,access_mis_report_subreport,mis.report.subreport,account.group_account_manager,crud,
access_mis_report_subreport,access_mis_report_subreport,mis.report.subreport,base.group_user,r,
manage_mis_report_style,access_mis_report_style,mis.report.style,account.group_account_manager,crud,
access_mis_report_style,access_mis_report_style,mis.report.style,base.group_user,r,
access_add_to_dashboard_wizard,access_add_to_dashboard_wizard,add.mis.report.instance.dashboard.wizard,base.group_user,cru,
access_read_mis_report_annotation,access_read_mis_report_annotation,mis.report.instance.annotation,mis_builder.group_read_annotation,r,
access_edit_mis_report_annotation,access_edit_mis_report_annotation,mis.report.instance.annotation,mis_builder.group_edit_annotation,crud,
24 changes: 0 additions & 24 deletions mis_builder/security/ir.model.access.csv

This file was deleted.

11 changes: 0 additions & 11 deletions mis_builder/security/mis_builder_security.xml

This file was deleted.

6 changes: 3 additions & 3 deletions mis_builder/security/res_groups.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="res.groups" id="group_read_annotation">
<record id="group_read_annotation" model="res.groups">
<field name="name">MIS Report: view annotations</field>
</record>
<record model="res.groups" id="group_edit_annotation">
<record id="group_edit_annotation" model="res.groups">
<field name="name">MIS Report: add annotations</field>
<field
name="implied_ids"
Expand Down
Loading
Loading