Skip to content

Commit

Permalink
[FIX] appease pylint_odoo
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Oct 28, 2023
1 parent 3fd4be6 commit 1479797
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
7 changes: 4 additions & 3 deletions mis_builder/models/kpimatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class KpiMatrixRow(object):

# TODO: ultimately, the kpi matrix will become ignorant of KPI's and
# accounts and know about rows, columns, sub columns and styles only.
# It is already ignorant of period and only knowns about columns.
Expand Down Expand Up @@ -308,8 +307,10 @@ def compute_comparisons(self):
common_subkpis = self._common_subkpis([col, base_col])
if (col.subkpis or base_col.subkpis) and not common_subkpis:
raise UserError(
_("Columns {} and {} are not comparable").format(
col.description, base_col.description
_(
"Columns %(descr)s and %(base_descr) are not comparable",

This comment has been minimized.

Copy link
@pedrobaeza

pedrobaeza Nov 1, 2023

Member

A trailing s seems to be missing in %(base_descr)

This comment has been minimized.

Copy link
@sbidoul

sbidoul Nov 1, 2023

Author Member

Ah, yes, good catch.

descr=col.description,
base_descr=base_col.description,
)
)
if not label:
Expand Down
22 changes: 14 additions & 8 deletions mis_builder/models/mis_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,23 +720,29 @@ def _declare_and_compute_col( # noqa: C901 (TODO simplify this fnction)
if len(vals) != col.colspan:
raise SubKPITupleLengthError(
_(
'KPI "{}" is valued as a tuple of '
"length {} while a tuple of length {} "
"is expected."
).format(kpi.description, len(vals), col.colspan)
'KPI "%(kpi)s" is valued as a tuple of '
"length %(length)s while a tuple of length"
"%(expected_length)s is expected.",
kpi=kpi.description,
length=len(vals),
expected_length=col.colspan,
)
)
elif isinstance(vals[0], DataError):
vals = (vals[0],) * col.colspan
else:
raise SubKPIUnknownTypeError(
_(
'KPI "{}" has type {} while a tuple was '
'KPI "%(kpi)s" has type %(type)s while a tuple was '
"expected.\n\nThis can be fixed by either:\n\t- "
"Changing the KPI value to a tuple of length "
"{}\nor\n\t- Changing the "
"%(length)s\nor\n\t- Changing the "
"KPI to `multi` mode and giving an explicit "
"value for each sub-KPI."
).format(kpi.description, type(vals[0]), col.colspan)
"value for each sub-KPI.",
kpi=kpi.description,
type=type(vals[0]),
length=col.colspan,
)
)
if len(drilldown_args) != col.colspan:
drilldown_args = [None] * col.colspan
Expand Down
6 changes: 4 additions & 2 deletions mis_builder/report/mis_report_instance_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ def generate_xlsx_report(self, workbook, data, objects):
now_tz = fields.Datetime.context_timestamp(
self.env["res.users"], datetime.now()
)
create_date = _("Generated on {} at {}").format(
now_tz.strftime(lang.date_format), now_tz.strftime(lang.time_format)
create_date = _(
"Generated on %(gen_date)s at %(gen_time)s",
gen_date=now_tz.strftime(lang.date_format),
gen_time=now_tz.strftime(lang.time_format),
)
sheet.write(row_pos, 0, create_date, footer_format)

Expand Down

0 comments on commit 1479797

Please sign in to comment.