Add suport of gift card for ecommerce.
Split the generic part to allow others modules to us it (e.g. pos)
A customer buy 1 Gift Card, he receive a code by mail and see it into the
sale order.
Another customer can now use this code in the payment step to deduce this
amount.
Product Gift card is sold by default without tax, because we don't know on wich
ecommerce, the shipping address ans sot the tax that will be used.
So the tax is deduce from the sale order that use the gift card.
We considere to be in the MPV case from:
https://www.vandelanotte.be/fr/actuel/actualites/624-les-bons-soumis-a-un-nouveau-regime-de-tva-a-partir-de-2019
Courtesy of @bvr-odoo for the email and product image
Co-Reviewed by @rde-odoo and @jke-be
task-2428004
pr-64195
closes odoo/odoo#64195
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
57 lines
2.6 KiB
XML
57 lines
2.6 KiB
XML
<?xml version="1.0" ?>
|
|
<odoo>
|
|
|
|
<template id="gift_card.used_gift_card">
|
|
<div class="text-muted d-none d-md-block small" t-if="line.gift_card_id">
|
|
<span>
|
|
Code:
|
|
<t t-esc="line.gift_card_id.code[-4:].rjust(14, '⋆')"/>
|
|
</span>
|
|
<br/>
|
|
<span>
|
|
Expired Date:
|
|
<t t-esc="line.gift_card_id.expired_date"/>
|
|
</span>
|
|
</div>
|
|
</template>
|
|
|
|
<template id="sale_order_portal_content_inherit" name="Gift Card Products Portal" inherit_id="sale.sale_order_portal_content">
|
|
<xpath expr="//section[@id='details']//td[@id='product_name']/*[last()]" position="after">
|
|
<t t-if="line.gift_card_id" t-call="gift_card.used_gift_card"/>
|
|
<t t-if="line.generated_gift_card_ids" t-call="gift_card.sale_purchased_gift_card">
|
|
<t t-set="order" t-value="sale_order"/>
|
|
<t t-set="hide_intro" t-value="1"/>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="sale_purchased_gift_card">
|
|
<div class="card mt-3 " t-if="order.gift_card_count != 0">
|
|
<div class="card-body">
|
|
<span t-if="not hide_intro">You will find below your gift cards code. An email has been sent with it. You can use it starting right now.</span>
|
|
<table class="table text-center table-borderless">
|
|
<thead>
|
|
<tr>
|
|
<th class="font-weight-normal">Gift Card Code</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<t t-foreach="order.order_line" t-as="order_line">
|
|
<tr t-foreach="order_line.generated_gift_card_ids" t-as="gift_card">
|
|
<td class="o_purchased_gift_card">
|
|
Gift #<t t-esc="gift_card.id"/>
|
|
(<span t-field="gift_card.initial_amount" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'display_currency': gift_card.currency_id}"/>)
|
|
<strong t-esc="gift_card.code"/>
|
|
<button class="btn btn-sm btn-secondary copy-to-clipboard" t-att-data-clipboard-text="gift_card.code">
|
|
<span class="fa fa-clipboard"/> Copy
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
</t>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</odoo>
|