From 1df6f4c74151d012f9ff784cef6eea58a5ac3b9e Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Mon, 9 Oct 2017 17:55:42 +0200 Subject: [PATCH] [FIX] ir_actions_report: Render correctly the base64 images in P3 Purpose ======= In python2 a binary field value is retrieved as a string. Example: company_id.logo = u'xyz' In python3 a binary field value is retrieved as a binary. Example: company_id.logo = b'xyz' When trying to render an image on a template, we should pass a stringified version of it. Specification ============= Pass the method to_text in the template rendering context and use it. --- addons/event/report/event_event_templates.xml | 4 ++-- addons/hr_attendance/report/hr_employee_badge.xml | 4 ++-- addons/stock/report/report_lot_barcode.xml | 2 +- addons/stock/report/report_package_barcode.xml | 2 +- addons/web/views/report_templates.xml | 8 ++++---- addons/website_livechat/views/website_livechat.xml | 4 ++-- odoo/addons/base/ir/ir_actions_report.py | 4 +++- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/event/report/event_event_templates.xml b/addons/event/report/event_event_templates.xml index 3f12a45cd42..76b64138f44 100644 --- a/addons/event/report/event_event_templates.xml +++ b/addons/event/report/event_event_templates.xml @@ -15,7 +15,7 @@
- +
( to )
@@ -65,7 +65,7 @@
- +

diff --git a/addons/hr_attendance/report/hr_employee_badge.xml b/addons/hr_attendance/report/hr_employee_badge.xml index 0961d0b178b..cac5c5eee16 100644 --- a/addons/hr_attendance/report/hr_employee_badge.xml +++ b/addons/hr_attendance/report/hr_employee_badge.xml @@ -20,12 +20,12 @@
- Company Logo + Company Logo
- Employee Image + Employee Image
diff --git a/addons/stock/report/report_lot_barcode.xml b/addons/stock/report/report_lot_barcode.xml index 788c8af9caf..1728782a2ef 100644 --- a/addons/stock/report/report_lot_barcode.xml +++ b/addons/stock/report/report_lot_barcode.xml @@ -27,7 +27,7 @@

- +
diff --git a/addons/stock/report/report_package_barcode.xml b/addons/stock/report/report_package_barcode.xml index 3911ba6f907..cdf626547cf 100644 --- a/addons/stock/report/report_package_barcode.xml +++ b/addons/stock/report/report_package_barcode.xml @@ -34,7 +34,7 @@
- +
diff --git a/addons/web/views/report_templates.xml b/addons/web/views/report_templates.xml index 0d164a844c2..23b1b71f0a0 100644 --- a/addons/web/views/report_templates.xml +++ b/addons/web/views/report_templates.xml @@ -142,7 +142,7 @@

- +
@@ -180,7 +180,7 @@
- +

@@ -216,7 +216,7 @@
- +
    @@ -259,7 +259,7 @@
    - +
    diff --git a/addons/website_livechat/views/website_livechat.xml b/addons/website_livechat/views/website_livechat.xml index c43c4294dec..3a0caa340ba 100644 --- a/addons/website_livechat/views/website_livechat.xml +++ b/addons/website_livechat/views/website_livechat.xml @@ -126,7 +126,7 @@
    -
    @@ -159,7 +159,7 @@
    - +

    diff --git a/odoo/addons/base/ir/ir_actions_report.py b/odoo/addons/base/ir/ir_actions_report.py index af6f448f839..9451a7ebff4 100644 --- a/odoo/addons/base/ir/ir_actions_report.py +++ b/odoo/addons/base/ir/ir_actions_report.py @@ -12,6 +12,7 @@ import time import base64 import io import logging +import odoo import os import lxml.html import tempfile @@ -465,7 +466,8 @@ class IrActionsReport(models.Model): user=user, res_company=user.company_id, website=website, - web_base_url=self.env['ir.config_parameter'].sudo().get_param('web.base.url', default='') + web_base_url=self.env['ir.config_parameter'].sudo().get_param('web.base.url', default=''), + to_text=odoo.tools.pycompat.to_text, ) return view_obj.render_template(template, values)