templates.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <openerp>
  3. <data>
  4. <template id="assets_frontend" inherit_id="website.assets_frontend" name="Shop">
  5. <xpath expr="." position="inside">
  6. <script type="text/javascript" src="/website_sale_add_curve/static/src/js/website_sale_multi_add.js"></script>
  7. </xpath>
  8. </template>
  9. <template id="variant_form" inherit_id="website_sale.variants" name="variants">
  10. <xpath expr="//t[@t-as='variant_id']" position="replace">
  11. <t t-foreach="product.attribute_line_ids" t-as="variant_id">
  12. <li t-if="len(variant_id.value_ids) &gt; 1">
  13. <t t-if="variant_id.attribute_id.type in ['select', 'hidden']">
  14. <select class="form-control js_variant_change" t-att-name="'attribute-%s-%s' % (product.id, variant_id.attribute_id.id)">
  15. <t t-foreach="variant_id.value_ids" t-as="value_id">
  16. <option t-att-value="value_id.id">
  17. <span t-field="value_id.name"/>
  18. <span t-if="value_id.price_extra">
  19. <t t-esc="value_id.price_extra &gt; 0 and '+' or ''"/><span
  20. t-field="value_id.price_extra"
  21. style="white-space: nowrap;"
  22. t-field-options="{ &quot;widget&quot;: &quot;monetary&quot;, &quot;from_currency&quot;: &quot;product.company_id.currency_id&quot;, &quot;display_currency&quot;: &quot;user_id.partner_id.property_product_pricelist.currency_id&quot; }"/>
  23. </span>
  24. </option>
  25. </t>
  26. </select>
  27. </t>
  28. <t t-if="product.product_website_sale_type == False">
  29. <input id="attribute_list" type="hidden" t-att-value="attribute_value_ids"></input>
  30. <div class="container">
  31. <div class="row text-left">
  32. <div class="col-md-12">
  33. <h3 t-field="variant_id.attribute_id.name"></h3>
  34. <table class="table text-center">
  35. <t t-if="variant_id.attribute_id.type == 'radio'">
  36. <ul class="list-unstyled">
  37. <t t-set="inc" t-value="0"/>
  38. <t t-foreach="variant_id.value_ids" t-as="value_id">
  39. <li class="form-group js_attribute_value">
  40. <tr>
  41. <td>
  42. <span t-field="value_id.name"/>
  43. <span class="badge" t-if="value_id.price_extra">
  44. <t t-esc="value_id.price_extra &gt; 0 and '+' or ''"/>
  45. <span t-field="value_id.price_extra" t-field-options="{ &quot;widget&quot;: &quot;monetary&quot;, &quot;from_currency&quot;: &quot;product.company_id.currency_id&quot;, &quot;display_currency&quot;: &quot;user_id.partner_id.property_product_pricelist.currency_id&quot; }"/>
  46. </span>
  47. </td>
  48. <td>
  49. <div class="input-group oe_website_spinner">
  50. <span class="input-group-addon">
  51. <a t-attf-href="#" class="mb8 js_add_cart_json">
  52. <i class="fa fa-minus"/>
  53. </a>
  54. </span>
  55. <input type="text" class="js_quantity form-control" data-min="1" name="add_qty" value="1" id="add_qty"/>
  56. <span class="input-group-addon">
  57. <a t-attf-href="#" class="mb8 float_left js_add_cart_json">
  58. <i class="fa fa-plus"/>
  59. </a>
  60. </span>
  61. </div>
  62. </td>
  63. <td>
  64. <button t-att-id="'attribute_%s' % value_id.id" type="button" class="js_variant_change btn btn-primary" t-att-checked="'checked' if not inc else ''" t-att-name="'attribute-%s-%s' % (product.id, variant_id.attribute_id.id)" t-att-value="inc+1">añadir a la cesta</button>
  65. </td>
  66. </tr>
  67. </li>
  68. <t t-set="inc" t-value="inc+1"/></t>
  69. </ul>
  70. </t>
  71. </table>
  72. <!-- Variante tipo color -->
  73. <t t-if="variant_id.attribute_id.type == 'color'">
  74. <input id="variant_list_color" type="hidden" t-att-value="variant_id.value_ids"></input>
  75. <ul class="list-inline">
  76. <t t-set="inc" t-value="0"/>
  77. <li t-foreach="variant_id.value_ids" t-as="value_id">
  78. <label t-attf-style="background-color:#{value_id.color or value_id.name}" t-attf-class="css_attribute_color #{'active' if not inc else ''}">
  79. <input type="radio" t-att-checked="'checked' if not inc else ''" t-att-name="'attribute_%s_%s' % (product.id, variant_id.attribute_id.id)" t-att-value="value_id.id" t-att-title="value_id.name" id="product_color"/>
  80. </label>
  81. <t t-set="inc" t-value="inc+1"/>
  82. </li>
  83. </ul>
  84. </t>
  85. </div>
  86. </div>
  87. </div>
  88. </t>
  89. <t t-if="product.product_website_sale_type == True">
  90. <input id="attribute_list" type="hidden" t-att-value="attribute_value_ids"></input>
  91. <input id="product_curva_qty" type="hidden" t-att-value="product.curva"></input>
  92. <div class="container">
  93. <div class="row">
  94. <div class="col-md-12">
  95. <t t-if="variant_id.attribute_id.type == 'color'">
  96. <input id="variant_list_color" type="hidden" t-att-value="variant_id.value_ids"></input>
  97. <h2 class="panel-title" t-field="variant_id.attribute_id.name"></h2>
  98. <ul class="list-inline">
  99. <t t-set="inc" t-value="0"/>
  100. <li t-foreach="variant_id.value_ids" t-as="value_id">
  101. <label t-attf-style="background-color:#{value_id.color or value_id.name}" t-attf-class="css_attribute_color #{'active' if not inc else ''}">
  102. <input type="radio" t-att-checked="'checked' if not inc else ''" t-att-name="'attribute_%s_%s' % (product.id, variant_id.attribute_id.id)" t-att-value="value_id.id" t-att-title="value_id.name" id="product_color2"/>
  103. </label>
  104. <t t-set="inc" t-value="inc+1"/>
  105. </li>
  106. </ul>
  107. </t>
  108. <t t-if="variant_id.attribute_id.type == 'radio'">
  109. <input id="variant_list" t-att-value="variant_id.value_ids" type="hidden"></input>
  110. <div class="panel panel-default">
  111. <div class="panel-heading">Detalle de Curva</div>
  112. <div class="panel-body text-center">
  113. <h1 class="panel-title" t-field="product.curva"></h1>
  114. </div>
  115. </div>
  116. <h2 class="panel-title" t-field="variant_id.attribute_id.name"></h2>
  117. <table class="table table-condenced text-center">
  118. <ul class="list-unstyled">
  119. <t t-set="inc" t-value="0"/>
  120. <tr>
  121. <t t-foreach="variant_id.value_ids" t-as="value_id">
  122. <li class="form-group js_attribute_value">
  123. <td>
  124. <span t-field="value_id.name"/>
  125. </td>
  126. </li>
  127. <t t-set="inc" t-value="inc+1"/></t>
  128. </tr>
  129. </ul>
  130. </table>
  131. <div class="container text-center">
  132. <button id="curva" class="btn btn-primary" href="">Comprar Curva</button>
  133. </div>
  134. </t>
  135. </div>
  136. </div>
  137. </div>
  138. </t>
  139. </li>
  140. </t>
  141. </xpath>
  142. </template>
  143. <!-- Oculta el boton 'add to cart' por defecto del odoo -->
  144. <template id="product_form" inherit_id="kingfisher_pro.kingfisher_pro_product_details" name="product">
  145. <xpath expr="//div[@class='add-to-cart']" position="replace">
  146. <div class="add-to-cart" style="display:none;">
  147. <a class="btn cart-btn btn-lg js_check_product a-submit" href="#" id="add_to_cart">
  148. <i class="fa fa-shopping-cart"/>Add to Cart</a>
  149. </div>
  150. </xpath>
  151. <xpath expr="//p[@class='css_not_available_msg bg-danger']" position="replace">
  152. <p style="display:none;" t-if="len(product.product_variant_ids) &gt; 1">Product not available</p>
  153. </xpath>
  154. </template>
  155. </data>
  156. </openerp>