Skip to content

Commit

Permalink
[FIX] mis_builder
Browse files Browse the repository at this point in the history
Make the code compatible with Python 3.9 to allow using official Odoo Docker containers
  • Loading branch information
ivs-cetmix committed Feb 8, 2024
1 parent 83e8888 commit 203ec4a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mis_builder/models/aep.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,4 +543,4 @@ def get_unallocated_pl(cls, companies, date):
# TODO shoud we include here the accounts of type "unaffected"
# or leave that to the caller?
bals = cls._get_balances(cls.MODE_UNALLOCATED, companies, date, date)
return tuple(map(sum, zip(*bals.values(), strict=True)))
return tuple(map(sum, zip(*bals.values()))) # noqa: B905
2 changes: 1 addition & 1 deletion mis_builder/models/expression_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def eval_expressions_by_account(self, expressions, locals_dict):
vals = []
drilldown_args = []
name_error = False
for expr, replaced_expr in zip(exprs, replaced_exprs, strict=True):
for expr, replaced_expr in zip(exprs, replaced_exprs): # noqa: B905
val = mis_safe_eval(replaced_expr, locals_dict)
vals.append(val)
if replaced_expr != expr:
Expand Down
7 changes: 2 additions & 5 deletions mis_builder/models/kpimatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ def set_values_detail_account(
cell_tuple = []
assert len(vals) == col.colspan
assert len(drilldown_args) == col.colspan
for val, drilldown_arg, subcol in zip(
vals, drilldown_args, col.iter_subcols(), strict=True
):
for val, drilldown_arg, subcol in zip(vals, drilldown_args, col.iter_subcols()): # noqa: B905
if isinstance(val, DataError):
val_rendered = val.name
val_comment = val.msg
Expand Down Expand Up @@ -347,11 +345,10 @@ def compute_comparisons(self):
if not common_subkpis or cell.subcol.subkpi in common_subkpis
]
comparison_cell_tuple = []
for val, base_val, comparison_subcol in zip(
for val, base_val, comparison_subcol in zip( # noqa: B905
vals,
base_vals,
comparison_col.iter_subcols(),
strict=True,
):
# TODO FIXME average factors
comparison = self._style_model.compare_and_render(
Expand Down
1 change: 1 addition & 0 deletions mis_builder/readme/newsfragments/590.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restore compatibility with python 3.9

0 comments on commit 203ec4a

Please sign in to comment.