From d70518d04f8f8061c8c683ea4ba8c95ae631ae45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Fri, 20 Oct 2017 19:52:28 +0200 Subject: [PATCH] [FIX] iap: py2 compatible version of previous fix Applying a proper way to deal with bytestring /byte correspondance in python2/3 respectively. fixing non retrocompatible code introduced in e9b969b39daeefe092e1bee584a424929daf14b1 --- addons/iap/models/iap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/iap/models/iap.py b/addons/iap/models/iap.py index 71713dfc3fd..5e264dc6715 100644 --- a/addons/iap/models/iap.py +++ b/addons/iap/models/iap.py @@ -8,6 +8,7 @@ import werkzeug.urls import requests from odoo import api, fields, models, exceptions +from odoo.tools import pycompat _logger = logging.getLogger(__name__) @@ -95,7 +96,7 @@ def charge(env, key, account_token, credit, description=None, credit_template=No except InsufficientCreditError as e: if credit_template: arguments = json.loads(e.args[0]) - arguments['body'] = env['ir.qweb'].render(credit_template).decode("utf-8") + arguments['body'] = pycompat.to_text(env['ir.qweb'].render(credit_template)) e.args = (json.dumps(arguments),) raise e try: