diff options
| author | Yannick Tivisse <yti@odoo.com> | 2017-10-09 17:55:42 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2017-10-10 10:39:43 +0200 |
| commit | 1df6f4c74151d012f9ff784cef6eea58a5ac3b9e (patch) | |
| tree | 4365f3bdcd4aa29d4d8a7fd3816078e3f5ea1746 /addons | |
| parent | 707c6b8016f2444494abfed97644b5022305aa05 (diff) | |
[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.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/event/report/event_event_templates.xml | 4 | ||||
| -rw-r--r-- | addons/hr_attendance/report/hr_employee_badge.xml | 4 | ||||
| -rw-r--r-- | addons/stock/report/report_lot_barcode.xml | 2 | ||||
| -rw-r--r-- | addons/stock/report/report_package_barcode.xml | 2 | ||||
| -rw-r--r-- | addons/web/views/report_templates.xml | 8 | ||||
| -rw-r--r-- | addons/website_livechat/views/website_livechat.xml | 4 |
6 files changed, 12 insertions, 12 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 @@ <div t-field="o.event_id.event_logo"/> </t> <span t-if="not o.event_id.event_logo and o.event_id.organizer_id.company_id.logo_web and o.event_id.organizer_id.is_company"> - <img t-att-src="'data:image/png;base64,%s' % o.event_id.organizer_id.company_id.logo_web" style="max-height:1cm; max-width:4cm;"/> + <img t-att-src="'data:image/png;base64,%s' % to_text(o.event_id.organizer_id.company_id.logo_web)" style="max-height:1cm; max-width:4cm;"/> </span> <h5 t-field="o.event_id.name"/> <h5>( <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="o.event_id.date_begin" t-options='{"hide_seconds": True}'> </span> <i>to</i> <span itemprop="endDate" t-field="o.event_id.date_end" t-options='{"hide_seconds": True}'> </span> )</h5> @@ -65,7 +65,7 @@ <div class="col-xs-12"> <span t-if="event.organizer_id.is_company and event.organizer_id.company_id.logo_web"> <div t-field="event.event_logo"> - <img t-att-src="'data:image/png;base64,%s' % event.organizer_id.company_id.logo_web" style="max-height:1cm; max-width:4cm;"/> + <img t-att-src="'data:image/png;base64,%s' % to_text(event.organizer_id.company_id.logo_web)" style="max-height:1cm; max-width:4cm;"/> </div> </span> <h4 t-field="event.name"/> 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 @@ <table style="width:77pt; height:150pt"> <tr style="height:30%"> <td align="center" valign="center"> - <img t-if="employee.company_id and employee.company_id.logo" t-att-src="'data:image/png;base64,%s' % (employee.company_id.logo,)" style="max-height:45pt;max-width:90%" alt="Company Logo"/> + <img t-if="employee.company_id and employee.company_id.logo" t-att-src="'data:image/png;base64,%s' % to_text(employee.company_id.logo)" style="max-height:45pt;max-width:90%" alt="Company Logo"/> </td> </tr> <tr style="height:70%;"> <td align="center" valign="center"> - <img t-if="employee.image" t-att-src="'data:image/png;base64,%s' % (employee.image,)" style="max-height:85pt;max-width:90%" alt="Employee Image"/> + <img t-if="employee.image" t-att-src="'data:image/png;base64,%s' % to_text(employee.image)" style="max-height:85pt;max-width:90%" alt="Employee Image"/> </td> </tr> </table> 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 @@ </table> </div> <div class="col-xs-4"> - <img class="image" t-att-src="'data:image/png;base64,%s' % res_company.logo" style="border:auto;"/> + <img class="image" t-att-src="'data:image/png;base64,%s' % to_text(res_company.logo)" style="border:auto;"/> </div> </div> <div class="row"> 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 @@ </table> </div> <div class="col-xs-4"> - <img class="image" t-att-src="'data:image/png;base64,%s' % res_company.logo" style="border:auto;"/> + <img class="image" t-att-src="'data:image/png;base64,%s' % to_text(res_company.logo)" style="border:auto;"/> </div> </div> <div class="row"> 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 @@ <div class="pull-right"> <h3 class="mt0 text-right" t-field="company.report_header"/> </div> - <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" class="pull-left"/> + <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % to_text(company.logo)" class="pull-left"/> <div class="pull-left company_address"> <div> <strong t-field="company.partner_id.name"/> @@ -180,7 +180,7 @@ <div class="header o_boxed_header"> <div class="row mb8"> <div class="col-xs-6"> - <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo"/> + <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % to_text(company.logo)"/> </div> <div class="col-xs-6 text-right mb4"> <h4 class="mt0" t-field="company.report_header"/> @@ -216,7 +216,7 @@ <div class="header o_clean_header"> <div class="row"> <div class="col-xs-6"> - <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo"/> + <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % to_text(company.logo)"/> </div> <div class="col-xs-5 col-xs-offset-1" name="company_address"> <ul class="list-unstyled"> @@ -259,7 +259,7 @@ <div class="header"> <div class="row"> <div class="col-xs-3 mb4"> - <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/> + <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % to_text(company.logo)" style="max-height: 45px;"/> </div> <div class="col-xs-9 text-right" style="margin-top:22px;" t-field="company.report_header" name="moto"/> </div> 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 @@ <t t-foreach="team" t-as="user" class="media"> <div class="media"> <div class="pull-left" t-if='user.image_small'> - <img t-att-src="user.image_small and ('data:image/png;base64,' + user.image_small) or '/web/static/src/img/placeholder.png'" + <img t-att-src="user.image_small and ('data:image/png;base64,' + to_text(user.image_small)) or '/web/static/src/img/placeholder.png'" class="img-rounded" t-att-alt="user.name"/> </div> <div class="media-body"> @@ -159,7 +159,7 @@ <t t-foreach="channels" t-as="channel"> <div class="media"> <a class="pull-left" t-attf-href="/livechat/channel/#{ slug(channel)}"> - <img t-att-src="channel.image_small and ('data:image/png;base64,' + channel.image_small) or '/web/static/src/img/placeholder.png'" t-att-alt="channel.name" /> + <img t-att-src="channel.image_small and ('data:image/png;base64,' + to_text(channel.image_small)) or '/web/static/src/img/placeholder.png'" t-att-alt="channel.name" /> </a> <div class="media-body"> <h4 class="media-heading"><t t-esc="channel.name"/></h4> |
