[FIX] payment(_demo,_custom): show 'Secured by' element

If payment_custom or payment_demo is installed 'Secured by' element is
overriden and becomes hidden for all payment providers.

We removed xpath as it is more convenient for the users to see which
provider is behind a payment method. After this commit 'Secured by'
element is shown for all providers except for custom.

closes odoo/odoo#155014

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Valeriya(vchu)
2024-02-23 13:10:01 +00:00
parent 40025c0990
commit bc2c4fbb3f
3 changed files with 8 additions and 23 deletions
@@ -214,7 +214,8 @@
<!-- === Provider name (only for desktop and tablet) === -->
<div class="col d-none d-md-block">
<p name="o_payment_secured_by_desktop" t-att-class="'mb-0 small text-600'
+ (' ms-4 ms-md-0' if allow_token_selection else '')"
+ (' ms-4 ms-md-0' if allow_token_selection else '')
+ (' d-none' if provider_sudo.code == 'custom' else '')"
>
<span><i class="fa fa-lock"/> Secured by</span>
<span t-out="dict(provider_sudo._fields['code']._description_selection(
@@ -240,7 +241,8 @@
</div>
<!-- === Provider name (only for mobile) === -->
<p name="o_payment_secured_by_mobile"
class="align-self-end d-block d-md-none mb-0 small text-600"
t-att-class="'align-self-end d-block d-md-none mb-0 small text-600'
+ (' d-none' if provider_sudo.code == 'custom' else '')"
>
<span><i class="fa fa-lock"/> Secured by</span>
<span t-out="dict(provider_sudo._fields['code']._description_selection(
@@ -350,7 +352,10 @@
</label>
</div>
<!-- === Provider name === -->
<p name="o_payment_secured_by" class="align-self-end mb-0 ms-auto small text-600">
<p name="o_payment_secured_by"
t-att-class="'align-self-end mb-0 ms-auto small text-600'
+ (' d-none' if provider_sudo.code == 'custom' else '')"
>
<span><i class="fa fa-lock"/> Secured by</span>
<span t-out="dict(provider_sudo._fields['code']._description_selection(
provider_sudo.env
@@ -2,19 +2,9 @@
<odoo>
<template id="payment_custom.token_form" inherit_id="payment.token_form">
<xpath expr="//p[@name='o_payment_secured_by_desktop']" position="attributes">
<attribute name="t-att-class"/>
<attribute name="class">d-none</attribute>
</xpath>
<xpath expr="//p[@name='o_payment_secured_by_mobile']" position="attributes">
<attribute name="class" separator=" " add="d-none"/>
</xpath>
</template>
<template id="payment_custom.payment_method_form" inherit_id="payment.method_form">
<xpath expr="//p[@name='o_payment_secured_by']" position="attributes">
<attribute name="class" separator=" " add="d-none"/>
</xpath>
</template>
<template id="redirect_form">
@@ -2,19 +2,9 @@
<odoo>
<template id="payment_demo.token_form" inherit_id="payment.token_form">
<xpath expr="//p[@name='o_payment_secured_by_desktop']" position="attributes">
<attribute name="t-att-class"/>
<attribute name="class">d-none</attribute>
</xpath>
<xpath expr="//p[@name='o_payment_secured_by_mobile']" position="attributes">
<attribute name="class" separator=" " add="d-none"/>
</xpath>
</template>
<template id="payment_demo.payment_method_form" inherit_id="payment.method_form">
<xpath expr="//p[@name='o_payment_secured_by']" position="attributes">
<attribute name="class" separator=" " add="d-none"/>
</xpath>
</template>
<template id="inline_form">