templates.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. <!-- Caso el cliente compre solo por curva, se despliega esta opcion -->
  31. <t t-if="user_id.partner_id.website_sale_type == True">
  32. <div class="container">
  33. <div class="row">
  34. <div class="col-md-12">
  35. <div class="panel panel-primary">
  36. <div class="panel-heading">
  37. <h3 class="panel-title" t-field="variant_id.attribute_id.name"></h3>
  38. </div>
  39. <table class="table table-condenced text-center">
  40. <t t-if="variant_id.attribute_id.type == 'radio'">
  41. <ul class="list-unstyled">
  42. <t t-set="inc" t-value="0"/>
  43. <tr>
  44. <t t-foreach="variant_id.value_ids" t-as="value_id">
  45. <li class="form-group js_attribute_value">
  46. <td>
  47. <span t-field="value_id.name"/>
  48. </td>
  49. </li>
  50. <t t-set="inc" t-value="inc+1"/></t>
  51. </tr>
  52. </ul>
  53. </t>
  54. </table>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </t>
  60. <!-- Caso el cliente compre por unidad, se despliega esta opcion -->
  61. <t t-if="user_id.partner_id.website_sale_type == False">
  62. <div class="container">
  63. <div class="row text-left">
  64. <div class="col-md-12">
  65. <div class="pricing-table">
  66. <div class="panel panel-dafault" style="border:none;">
  67. <div class="panel-body panel-body-landing">
  68. <table class="table table-condenced text-center">
  69. <!-- Variante tipo radio -->
  70. <t t-if="variant_id.attribute_id.type == 'radio'">
  71. <input id="attribute_list" type="hidden" t-att-value="attribute_value_ids"></input>
  72. <input id="variant_list" type="hidden" t-att-value="variant_id.value_ids"></input>
  73. <input id="product_curva" type="hidden" t-att-value="product.variant_item_ids"/>
  74. <input id="product_curva_qty" type="hidden" t-att-value="product.curva"/>
  75. <ul class="list-unstyled">
  76. <t t-set="inc" t-value="0"/>
  77. <t t-foreach="variant_id.value_ids" t-as="value_id">
  78. <li class="form-group js_attribute_value">
  79. <tr>
  80. <td>
  81. <span t-field="value_id.name"/>
  82. </td>
  83. <td>
  84. <span class="badge" t-if="value_id.price_extra">
  85. <t t-esc="value_id.price_extra &gt; 0 and '+' or ''"/>
  86. <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>
  87. </td>
  88. <td>
  89. <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>
  90. </td>
  91. </tr>
  92. </li>
  93. <t t-set="inc" t-value="inc+1"/></t>
  94. </ul>
  95. </t>
  96. </table>
  97. <!-- Variante tipo color -->
  98. <t t-if="variant_id.attribute_id.type == 'color'">
  99. <input id="variant_list_color" type="hidden" t-att-value="variant_id.value_ids"></input>
  100. <ul class="list-inline">
  101. <t t-set="inc" t-value="0"/>
  102. <li t-foreach="variant_id.value_ids" t-as="value_id">
  103. <label t-attf-style="background-color:#{value_id.color or value_id.name}" t-attf-class="css_attribute_color #{'active' if not inc else ''}">
  104. <!-- <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"/> -->
  105. <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"/>
  106. </label>
  107. <t t-set="inc" t-value="inc+1"/>
  108. </li>
  109. </ul>
  110. </t>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </t>
  118. </li>
  119. <t t-if="user_id.partner_id.website_sale_type == True">
  120. <div class="container text-center">
  121. <button id="curva" class="btn btn-primary" href="">Comprar Curva</button>
  122. </div>
  123. </t>
  124. </t>
  125. </xpath>
  126. </template>
  127. <!-- Oculta el boton 'add to cart' por defecto del odoo -->
  128. <template id="product_form" inherit_id="website_sale.product" name="product">
  129. <xpath expr="//a[@id='add_to_cart']" position="replace">
  130. <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>
  131. </xpath>
  132. </template>
  133. <!-- Oculta el spinner de cantidad -->
  134. <template id="product_quantity_form" inherit_id="website_sale.product_quantity" name="product_quantity">
  135. <xpath expr="//div[@class='css_quantity input-group oe_website_spinner']" position="replace">
  136. <div class="css_quantity input-group oe_website_spinner" style="display:none;">
  137. <span class="input-group-addon">
  138. <a t-attf-href="#" class="mb8 js_add_cart_json">
  139. <i class="fa fa-minus"/>
  140. </a>
  141. </span>
  142. <input type="text" class="js_quantity form-control" data-min="1" name="add_qty" value="1"/>
  143. <span class="input-group-addon">
  144. <a t-attf-href="#" class="mb8 float_left js_add_cart_json">
  145. <i class="fa fa-plus"/>
  146. </a>
  147. </span>
  148. </div>
  149. </xpath>
  150. </template>
  151. </data>
  152. </openerp>