templates.xml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?xml version="1.0" ?>
  2. <odoo>
  3. <template id="sale_loyalty.used_gift_card">
  4. <div class="text-muted d-md-block small"
  5. t-if="line.coupon_id and line.order_id != line.coupon_id.order_id and not line.coupon_id.program_id.is_nominative">
  6. <span>
  7. Code:
  8. <t t-esc="line.coupon_id.code[-4:].rjust(14, '&#8902;')"/>
  9. </span>
  10. <t t-if="line.coupon_id.expiration_date">
  11. <br/>
  12. <span>
  13. Expired Date:
  14. <t t-esc="line.coupon_id.expiration_date"/>
  15. </span>
  16. </t>
  17. </div>
  18. </template>
  19. <template id="sale_order_portal_content_inherit" name="Gift Card Products Portal" inherit_id="sale.sale_order_portal_content">
  20. <xpath expr="//section[@id='details']//td[@id='product_name']/*[last()]" position="after">
  21. <t t-if="line.coupon_id and line.coupon_id.program_id.program_type == 'gift_card'" t-call="sale_loyalty.used_gift_card"/>
  22. </xpath>
  23. <xpath expr="//div[@id='total']" position="after">
  24. <t t-call="sale_loyalty.sale_purchased_gift_card">
  25. <t t-set="order" t-value="sale_order"/>
  26. <t t-set="hide_intro" t-value="1"/>
  27. </t>
  28. </xpath>
  29. </template>
  30. <template id="sale_purchased_gift_card">
  31. <t t-set="gift_cards" t-value="order.coupon_point_ids.filtered(lambda pe: pe.coupon_id.program_id.program_type == 'gift_card').coupon_id"/>
  32. <div class="card mt-3 " t-if="gift_cards and order.state in ('sale', 'done')">
  33. <div class="card-body">
  34. <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>
  35. <table class="table text-center table-borderless">
  36. <thead>
  37. <tr>
  38. <th class="fw-normal">Gift Card Code</th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. <t t-foreach="range(len(gift_cards))" t-as="gift_card_idx">
  43. <t t-set="gift_card" t-value="gift_cards[gift_card_idx]"/>
  44. <td class="o_purchased_gift_card">
  45. Gift #<t t-esc="gift_card_idx + 1"/>
  46. (<span t-esc="order._get_real_points_for_coupon(gift_card, post_confirm=True)"/> <span t-esc="gift_card.point_name"/>)
  47. <strong t-esc="gift_card.code"/>
  48. <button class="btn btn-sm btn-secondary copy-to-clipboard" t-att-data-clipboard-text="gift_card.code">
  49. <span class="fa fa-clipboard"/> Copy
  50. </button>
  51. </td>
  52. </t>
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. </template>
  58. </odoo>