summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_template.py
diff options
context:
space:
mode:
authorxmo-odoo <xmo@odoo.com>2017-04-27 13:59:33 +0200
committerGitHub <noreply@github.com>2017-04-27 13:59:33 +0200
commit2e6a589f417af48e3322955ffff6e94b6d8a24e3 (patch)
treeaa613ecc1f74a9531a03de89aa2bdc7bb32eed3b /addons/mail/models/mail_template.py
parentde4a2216b953abb86094c9bfa5f45b1eaaa79d3d (diff)
[FIX] builtins removed from Python 3
* Reverse wrapper courtesy of @rco-odoo's original P3 branch * thin compat module stripped down from werkzeug (to augment as needed) issue 8530
Diffstat (limited to 'addons/mail/models/mail_template.py')
-rw-r--r--addons/mail/models/mail_template.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py
index 1fc922a0d55..2c989bb7e2e 100644
--- a/addons/mail/models/mail_template.py
+++ b/addons/mail/models/mail_template.py
@@ -7,6 +7,8 @@ import copy
import datetime
import dateutil.relativedelta as relativedelta
import logging
+
+import functools
import lxml
import urlparse
@@ -15,6 +17,7 @@ from urllib import urlencode, quote as quote
from odoo import _, api, fields, models, tools
from odoo import report as odoo_report
from odoo.exceptions import UserError
+from odoo.tools import pycompat
_logger = logging.getLogger(__name__)
@@ -90,10 +93,9 @@ try:
'max': max,
'sum': sum,
'filter': filter,
- 'reduce': reduce,
+ 'reduce': functools.reduce,
'map': map,
'round': round,
- 'cmp': cmp,
# dateutil.relativedelta is an old-style class and cannot be directly
# instanciated wihtin a jinja2 expression, so a lambda "proxy" is
@@ -340,7 +342,7 @@ class MailTemplate(models.Model):
:param int res_ids: list of ids of document records those mails are related to.
"""
multi_mode = True
- if isinstance(res_ids, (int, long)):
+ if isinstance(res_ids, pycompat.integer_types):
multi_mode = False
res_ids = [res_ids]
@@ -385,7 +387,7 @@ class MailTemplate(models.Model):
@api.multi
def get_email_template(self, res_ids):
multi_mode = True
- if isinstance(res_ids, (int, long)):
+ if isinstance(res_ids, pycompat.integer_types):
res_ids = [res_ids]
multi_mode = False
@@ -450,7 +452,7 @@ class MailTemplate(models.Model):
"""
self.ensure_one()
multi_mode = True
- if isinstance(res_ids, (int, long)):
+ if isinstance(res_ids, pycompat.integer_types):
res_ids = [res_ids]
multi_mode = False
if fields is None: