Browse Source

[UPDT] Optional Products Bug Fixed

pull/94/head
Sreejith P 7 years ago
parent
commit
ada6ce4533
  1. 121
      website_coupon/views/templates.xml

121
website_coupon/views/templates.xml

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<template id="voucher_code" inherit_id="website_sale.cart" active="False" customize_show="True" name="Voucher Code"> <template id="voucher_code" inherit_id="website_sale.cart"
<xpath expr="//div[hasclass('o_website_sale_rightfit')]" position="after"> active="False" customize_show="True"
name="Voucher Code">
<xpath expr="//div[hasclass('o_website_sale_rightfit')]"
position="after">
<h4>Voucher Code</h4> <h4>Voucher Code</h4>
<p> <p>
Have a voucher code? Fill this field and apply. Have a voucher code? Fill this field and apply.
@ -17,10 +20,15 @@
<p class="bg-warning">The discount amount is too large</p> <p class="bg-warning">The discount amount is too large</p>
</t> </t>
</t> </t>
<form t-if="website_sale_order and website_sale_order.website_order_line" action="/shop/gift_coupon" method="post" class="mb32"> <form t-if="website_sale_order and website_sale_order.website_order_line"
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" /> action="/shop/gift_coupon" method="post"
class="mb32">
<input type="hidden" name="csrf_token"
t-att-value="request.csrf_token()" />
<div class="input-group"> <div class="input-group">
<input name="promo_voucher" class="form-control" type="text" placeholder="code..." t-att-value="website_sale_order.pricelist_id.code or None" /> <input name="promo_voucher" class="form-control"
type="text" placeholder="code..."
t-att-value="website_sale_order.pricelist_id.code or None" />
<div class="input-group-btn"> <div class="input-group-btn">
<a class="btn btn-default a-submit">Apply</a> <a class="btn btn-default a-submit">Apply</a>
</div> </div>
@ -30,69 +38,50 @@
</template> </template>
<template id="cart_lines_extended" inherit_id="website_sale.cart_lines"> <template id="cart_lines_extended" inherit_id="website_sale.cart_lines">
<xpath expr="//table[@id='cart_products']" position="replace"> <xpath expr="//table[@id='cart_products']/thead/tr/th[1]" position="attributes">
<table class="table table-striped table-condensed js_cart_lines" id="cart_products" t-if="website_sale_order and website_sale_order.website_order_line"> <attribute name="width">100</attribute>
<thead> </xpath>
<tr> <xpath expr="//table[@id='cart_products']/thead/tr/th[3]" position="attributes">
<th width="100">Product</th> <attribute name="width">130</attribute>
<th></th> </xpath>
<th width="130" class="text-center">Quantity</th> <xpath expr="//table[@id='cart_products']/thead/tr/th[4]" position="attributes">
<th width="100" class="text-center">Price</th> <attribute name="width">100</attribute>
</tr> </xpath>
</thead>
<tbody> <xpath expr="//table[@id='cart_products']/tbody//td[hasclass('td-qty')]/div"
<t t-foreach="website_sale_order.website_order_line" t-as="line"> position="replace">
<tr> <div class="css_quantity input-group oe_website_spinner">
<td colspan="2" t-if="not line.product_id.product_tmpl_id"></td> <t t-if="line.product_id.display_name == 'Gift Coupon'">
<td align="center" t-if="line.product_id.product_tmpl_id"> <a href='#' class='js_delete_product no-decoration'>
<span t-field="line.product_id.image_small" t-options="{'widget': 'image', 'class': 'img-rounded'}" /> <small>
</td> <i class='fa fa-trash-o'></i>
<td t-if="line.product_id.product_tmpl_id"> Remove
<div> </small>
<a t-attf-href="/shop/product/#{ slug(line.product_id.product_tmpl_id) }"> </a>
<strong t-esc="line.product_id.with_context(display_default_code=False).display_name" /> <input type="hidden" class="js_quantity form-control"
</a> t-att-data-line-id="line.id"
</div> t-att-data-product-id="line.product_id.id"
<div class="text-muted"> t-att-value="int(line.product_uom_qty)"
<t t-foreach="line.name.splitlines()[1:]" t-as="name_line"> />
<span><t t-esc="name_line"/></span><br/>
</t>
</div>
<t t-if="line.product_id.display_name != 'Gift Coupon'">
<a href='#' class='js_delete_product no-decoration'> <small><i class='fa fa-trash-o'></i> Remove</small></a>
</t>
</td>
<td class="text-center" id="td-qty">
<t t-if="line.product_id.display_name == 'Gift Coupon'">
<a href='#' class='js_delete_product no-decoration'> <small><i class='fa fa-trash-o'></i> Remove</small></a>
<div class="input-group oe_website_spinner">
<input type="hidden" class="js_quantity form-control" t-att-data-line-id="line.id" t-att-data-product-id="line.product_id.id" t-att-value="int(line.product_uom_qty)" />
</div>
</t>
<t t-if="line.product_id.display_name != 'Gift Coupon'">
<div class="input-group oe_website_spinner">
<a t-attf-href="#" class="mb8 input-group-addon js_add_cart_json" data-no-instant="">
<i class="fa fa-minus"></i>
</a>
<input type="text" class="js_quantity form-control" t-att-data-line-id="line.id" t-att-data-product-id="line.product_id.id" t-att-value="int(line.product_uom_qty)" />
<a t-attf-href="#" class="mb8 input-group-addon float_left js_add_cart_json" data-no-instant="">
<i class="fa fa-plus"></i>
</a>
</div>
</t>
</td>
<td class="text-center" id="td-price" name="price">
<t t-if="(compute_currency(line.product_id.lst_price) - line.price_reduce ) &gt; 0.01 and website.get_current_pricelist().discount_policy=='without_discount'">
<del t-attf-class="#{'text-danger mr8'}" style="white-space: nowrap;" t-esc="compute_currency(line.product_id.website_public_price)" t-options="{'widget': 'monetary', 'display_currency': website.get_current_pricelist().currency_id, 'from_currency': website.currency_id}" />
</t>
<span t-field="line.price_reduce_taxexcl" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': website_sale_order.pricelist_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_subtotal" />
<span t-field="line.price_reduce_taxinc" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': website_sale_order.pricelist_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_total" />
</td>
</tr>
</t> </t>
</tbody>
</table>
<t t-if="line.product_id.display_name != 'Gift Coupon'">
<a t-attf-href="#"
class="mb8 input-group-addon js_add_cart_json"
data-no-instant="">
<i class="fa fa-minus"></i>
</a>
<input type="text" class="js_quantity form-control"
t-att-data-line-id="line.id"
t-att-data-product-id="line.product_id.id"
t-att-value="int(line.product_uom_qty)" />
<a t-attf-href="#"
class="mb8 input-group-addon float_left js_add_cart_json"
data-no-instant="">
<i class="fa fa-plus"></i>
</a>
</t>
</div>
</xpath> </xpath>
</template> </template>
</odoo> </odoo>
Loading…
Cancel
Save