Skip to content

Commit

Permalink
[FIX] Payment: prevent error in rendering payment icon list with PIL …
Browse files Browse the repository at this point in the history
…incompatible icon image formats

Replace the use of 't-esc' with 't-field' for the payment icon image in
the icons list template. The latter, for an image field, provides two
options for rendering the payment icon image: use the PIL library to
obtain the image when given the option 'qweb_img_raw_data', or use a
URL. The former only considers the first option, allowing only image
formats compatible with the PIL library.

X-original-commit: bc76cca
  • Loading branch information
CLaurelB authored and AntoineVDV committed Mar 28, 2024
1 parent aa09df2 commit 78d2c21
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions addons/payment/views/payment_form_templates.xml
Expand Up @@ -228,8 +228,7 @@
</div>
<!-- === Payment method logo === -->
<div t-call="payment.form_logo">
<t t-set="logo" t-value="token_sudo.payment_method_id.image_payment_form"/>
<t t-set="title" t-value="token_sudo.payment_method_id.name"/>
<t t-set="logo_pm_sudo" t-value="token_sudo.payment_method_id"/>
</div>
</div>
<!-- === Inline form === -->
Expand Down Expand Up @@ -309,8 +308,7 @@
<t t-set="pm_index" t-value="0"/>
<t t-foreach="pms_to_display_sudo" t-as="pm_to_display_sudo">
<t t-if="pm_index &lt; 4" t-call="payment.form_logo">
<t t-set="logo" t-value="pm_to_display_sudo.image_payment_form"/>
<t t-set="title" t-value="pm_to_display_sudo.name"/>
<t t-set="logo_pm_sudo" t-value="pm_to_display_sudo"/>
</t>
<t t-set="pm_index" t-value="pm_index + 1"/>
</t>
Expand Down Expand Up @@ -383,13 +381,13 @@

<template id="payment.form_logo" name="Form Logo">
<!-- Parameters description:
- logo: The logo to display, as an `Image` field.
- title: The title to display on hover.
- logo_pm_sudo: The payment method whose logo to display, as a sudoed `payment.method`
record.
-->
<span t-out="logo"
<span t-field="logo_pm_sudo.image_payment_form"
t-options="{'widget': 'image', 'alt-field': 'name'}"
class="position-relative d-block rounded overflow-hidden z-index-1 shadow-sm"
t-att-title="title"
t-att-title="logo_pm_sudo.name"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-delay="0"
Expand Down

0 comments on commit 78d2c21

Please sign in to comment.