Skip to content

Commit

Permalink
Merge branch 'Eficent-10.0-python3-compatibility' into 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Nov 17, 2017
2 parents 94c1ebe + 1142244 commit edc61e9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
7 changes: 5 additions & 2 deletions mis_builder/models/aep.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import datetime
import re
from collections import defaultdict
from itertools import izip
try:
import itertools.izip as zip
except ImportError:
pass # python 3
import time

import dateutil
Expand Down Expand Up @@ -519,4 +522,4 @@ def get_unallocated_pl(cls, companies, date, target_move='posted'):
# or leave that to the caller?
bals = cls._get_balances(cls.MODE_UNALLOCATED, companies,
date, date, target_move)
return tuple(map(sum, izip(*bals.values())))
return tuple(map(sum, zip(*bals.values())))
11 changes: 6 additions & 5 deletions mis_builder/models/kpimatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from collections import defaultdict, OrderedDict
from itertools import izip
try:
import itertools.izip as zip
except ImportError:
pass # python 3
import logging

from odoo import _
Expand Down Expand Up @@ -233,7 +236,7 @@ def set_values_detail_account(self, kpi, col_key, account_id, vals,
assert len(vals) == col.colspan
assert len(drilldown_args) == col.colspan
for val, drilldown_arg, subcol in \
izip(vals, drilldown_args, col.iter_subcols()):
zip(vals, drilldown_args, col.iter_subcols()):
if isinstance(val, DataError):
val_rendered = val.name
val_comment = val.msg
Expand Down Expand Up @@ -323,9 +326,7 @@ def compute_comparisons(self):
cell.subcol.subkpi in common_subkpis]
comparison_cell_tuple = []
for val, base_val, comparison_subcol in \
izip(vals,
base_vals,
comparison_col.iter_subcols()):
zip(vals, base_vals, comparison_col.iter_subcols()):
# TODO FIXME average factors
delta, delta_r, style_r = \
self._style_model.compare_and_render(
Expand Down
7 changes: 5 additions & 2 deletions mis_builder/models/mis_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

from collections import defaultdict
import datetime
from itertools import izip
try:
import itertools.izip as zip
except ImportError:
pass # python 3
import logging
import re
import time
Expand Down Expand Up @@ -799,7 +802,7 @@ def eval_expressions_by_account(expressions, locals_dict):
drilldown_args = []
name_error = False
for expression, replaced_expr in \
izip(expressions, replaced_exprs):
zip(expressions, replaced_exprs):
vals.append(mis_safe_eval(replaced_expr, locals_dict))
if replaced_expr != expression:
drilldown_args.append({
Expand Down
6 changes: 6 additions & 0 deletions mis_builder/models/mis_report_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

import sys

from odoo import api, fields, models, _
from odoo.exceptions import ValidationError

from .accounting_none import AccountingNone
from .data_error import DataError


if sys.version_info.major >= 3:
unicode = str


class PropertyDict(dict):

def __getattr__(self, name):
Expand Down

0 comments on commit edc61e9

Please sign in to comment.