templates.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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_multi_add/static/src/js/website_sale_multi_add.js"></script>
  7. <!-- <link rel='stylesheet' href='/website_sale_stock_status/static/src/css/website_sale_stock_status.css'/> -->
  8. </xpath>
  9. </template>
  10. <template id="variant_form" inherit_id="website_sale.variants" name="variants">
  11. <xpath expr="//t[@t-as='variant_id']" position="replace">
  12. <t t-foreach="product.attribute_line_ids" t-as="variant_id">
  13. <li t-if="len(variant_id.value_ids) &gt; 1">
  14. <!-- Caso la variante sea distinto a tipo radio o tipo color -->
  15. <t t-if="variant_id.attribute_id.type in ['select', 'hidden']">
  16. <select class="form-control js_variant_change" t-att-name="'attribute-%s-%s' % (product.id, variant_id.attribute_id.id)">
  17. <t t-foreach="variant_id.value_ids" t-as="value_id">
  18. <option t-att-value="value_id.id">
  19. <span t-field="value_id.name"/>
  20. <span t-if="value_id.price_extra">
  21. <t t-esc="value_id.price_extra &gt; 0 and '+' or ''"/><span
  22. t-field="value_id.price_extra"
  23. style="white-space: nowrap;"
  24. 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; }"/>
  25. </span>
  26. </option>
  27. </t>
  28. </select>
  29. </t>
  30. <input id="attribute_list" type="hidden" t-att-value="attribute_value_ids"></input>
  31. <input id="variant_list" type="hidden" t-att-value="variant_id.value_ids"></input>
  32. <input id="product_curva" type="hidden" t-att-value="product.variant_item_ids"/>
  33. <input id="product_curva_qty" type="hidden" t-att-value="product.curva"/>
  34. <!-- Caso el cliente compre solo por curva, se despliega esta opcion -->
  35. <t t-if="user_id.partner_id.website_sale_type == True">
  36. <div class="container">
  37. <div class="row">
  38. <div class="col-md-12">
  39. <!-- Variante tipo color -->
  40. <t t-if="variant_id.attribute_id.type == 'color'">
  41. <h2 class="panel-title" t-field="variant_id.attribute_id.name"></h2>
  42. <input id="variant_list_color" type="hidden" t-att-value="variant_id.value_ids"></input>
  43. <ul class="list-inline">
  44. <t t-set="inc" t-value="0"/>
  45. <li t-foreach="variant_id.value_ids" t-as="value_id">
  46. <label t-attf-style="background-color:#{value_id.color or value_id.name}" t-attf-class="css_attribute_color #{'active' if not inc else ''}">
  47. <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"/>
  48. </label>
  49. <t t-set="inc" t-value="inc+1"/>
  50. </li>
  51. </ul>
  52. </t>
  53. <t t-if="variant_id.attribute_id.type == 'radio'">
  54. <h2 class="panel-title" t-field="variant_id.attribute_id.name"></h2>
  55. <table class="table table-condenced text-center">
  56. <ul class="list-unstyled">
  57. <t t-set="inc" t-value="0"/>
  58. <tr>
  59. <t t-foreach="variant_id.value_ids" t-as="value_id">
  60. <li class="form-group js_attribute_value">
  61. <td>
  62. <span t-field="value_id.name"/>
  63. </td>
  64. </li>
  65. <t t-set="inc" t-value="inc+1"/></t>
  66. </tr>
  67. </ul>
  68. </table>
  69. </t>
  70. </div>
  71. </div>
  72. </div>
  73. </t>
  74. <!-- Caso el cliente compre por unidad, se despliega esta opcion -->
  75. <t t-if="user_id.partner_id.website_sale_type == False">
  76. <div class="container">
  77. <div class="row text-left">
  78. <div class="col-md-12">
  79. <div class="pricing-table">
  80. <div class="panel panel-dafault" style="border:none;">
  81. <div class="panel-body panel-body-landing">
  82. <table class="table table-condenced text-center">
  83. <!-- Variante tipo radio -->
  84. <t t-if="variant_id.attribute_id.type == 'radio'">
  85. <ul class="list-unstyled">
  86. <t t-set="inc" t-value="0"/>
  87. <t t-foreach="variant_id.value_ids" t-as="value_id">
  88. <li class="form-group js_attribute_value">
  89. <tr>
  90. <td>
  91. <span t-field="value_id.name"/>
  92. </td>
  93. <td>
  94. <span class="badge" t-if="value_id.price_extra">
  95. <t t-esc="value_id.price_extra &gt; 0 and '+' or ''"/>
  96. <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; }"/></span>
  97. </td>
  98. <td>
  99. <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">Agregar al carro</button>
  100. </td>
  101. </tr>
  102. </li>
  103. <t t-set="inc" t-value="inc+1"/></t>
  104. </ul>
  105. </t>
  106. </table>
  107. <!-- Variante tipo color -->
  108. <t t-if="variant_id.attribute_id.type == 'color'">
  109. <input id="variant_list_color" type="hidden" t-att-value="variant_id.value_ids"></input>
  110. <ul class="list-inline">
  111. <t t-set="inc" t-value="0"/>
  112. <li t-foreach="variant_id.value_ids" t-as="value_id">
  113. <label t-attf-style="background-color:#{value_id.color or value_id.name}" t-attf-class="css_attribute_color #{'active' if not inc else ''}">
  114. <!-- <input type="radio" class="js_variant_change" 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"/> -->
  115. <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"/>
  116. </label>
  117. <t t-set="inc" t-value="inc+1"/>
  118. </li>
  119. </ul>
  120. </t>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </t>
  128. </li>
  129. </t>
  130. <t t-if="user_id.partner_id.website_sale_type == True">
  131. <div class="container text-center">
  132. <button id="curva" class="btn" href="">Comprar Curva</button>
  133. </div>
  134. </t>
  135. </xpath>
  136. </template>
  137. <!-- Oculta el boton 'add to cart' por defecto del odoo -->
  138. <template id="product_form" inherit_id="website_sale.product" name="product">
  139. <xpath expr="//a[@id='add_to_cart']" position="replace">
  140. <a id="add_to_cart" class="btn btn-primary btn-lg mt8 js_check_product a-submit" href="#" style="display:none;">Add to Cart</a>
  141. </xpath>
  142. </template>
  143. <!-- Oculta el spinner de cantidad -->
  144. <template id="product_quantity_form" inherit_id="website_sale.product_quantity" name="product_quantity">
  145. <xpath expr="//div[@class='css_quantity input-group oe_website_spinner']" position="replace">
  146. <div class="css_quantity input-group oe_website_spinner" style="display:none;">
  147. <span class="input-group-addon">
  148. <a t-attf-href="#" class="mb8 js_add_cart_json">
  149. <i class="fa fa-minus"/>
  150. </a>
  151. </span>
  152. <input type="text" class="js_quantity form-control" data-min="1" name="add_qty" value="1"/>
  153. <span class="input-group-addon">
  154. <a t-attf-href="#" class="mb8 float_left js_add_cart_json">
  155. <i class="fa fa-plus"/>
  156. </a>
  157. </span>
  158. </div>
  159. </xpath>
  160. </template>
  161. </data>
  162. </openerp>