[FIX] website_sale_coupon: remove duplicated controller and view

This commit is contained in:
Jeremy Kersten
2017-03-10 17:53:57 +01:00
parent e93293a856
commit 535d6360e2
2 changed files with 3 additions and 50 deletions
+1 -11
View File
@@ -10,16 +10,6 @@ class WebsiteSale(WebsiteSale):
def pricelist(self, promo, **post):
order = request.website.sale_get_order()
coupon_status = request.env['sale.coupon.apply.code'].sudo().apply_coupon(order, promo)
print coupon_status.get('error', False)
if coupon_status.get('error', False):
return super(WebsiteSale, self).pricelist(promo, **post)
return request.redirect("/shop/cart")
@http.route(['/shop/pricelist_payment'], type='http', auth="public", website=True)
def pricelist_payment(self, promo, **post):
order = request.website.sale_get_order()
coupon_status = request.env['sale.coupon.apply.code'].sudo().apply_coupon(order, promo)
print coupon_status.get('error', False)
if coupon_status.get('error', False):
return super(WebsiteSale, self).pricelist(promo, **post)
return request.redirect("/shop/payment")
return request.redirect(post.get('r', '/shop/cart'))
+2 -39
View File
@@ -13,7 +13,7 @@
</div>
</xpath>
</template>
<template id="sale_coupon_result" inherit_id="website_sale.reduction_code">
<template id="sale_coupon_result" inherit_id="website_sale.coupon_form">
<xpath expr="//form[@name='coupon_code']" position="after">
<t t-if="website_sale_order and website_sale_order.applied_coupon_ids">
<t t-foreach="website_sale_order.applied_coupon_ids" t-as="coupon">
@@ -40,44 +40,7 @@
</div>
</t>
</t>
<t t-if="code_not_available">
<div class="panel panel-danger mt16">
<div class="panel-heading clearfix">
<span class="pull-left">Invalid or expired coupon code</span>
</div>
</div>
</t>
</xpath>
<xpath expr="//t[@name='code_not_available']" position="replace"/>
</template>
<template id="sale_coupon_result_payment" inherit_id="website_sale.reduction_code_payment">
<xpath expr="//form[@name='coupon_code']" position="after">
<t t-if="website_sale_order and website_sale_order.applied_coupon_ids">
<t t-foreach="website_sale_order.applied_coupon_ids" t-as="coupon">
<div class="panel panel-success mt16">
<div class="panel-heading clearfix">
<span class="pull-left">You have successfully applied coupon: <b t-esc="coupon.code"/></span>
</div>
</div>
</t>
</t>
<t t-if="website_sale_order and website_sale_order.promo_code">
<div class="panel panel-success mt16">
<div class="panel-heading clearfix">
<span class="pull-left">You have successfully applied coupon: <b t-esc="website_sale_order.promo_code"/></span>
</div>
</div>
</t>
<t t-if="website_sale_order and website_sale_order.generated_coupon_ids">
<t t-foreach="website_sale_order.generated_coupon_ids" t-as="coupon">
<div class="panel panel-success mt16">
<div class="panel-heading clearfix">
<span class="pull-left">Your reward <b t-esc="coupon.discount_line_product_id.name"/> is available on a next order with this coupon code: <b t-esc="coupon.code"/></span>
</div>
</div>
</t>
</t>
<t t-if="code_not_available">
<t t-if="request.params.get('code_not_available')">
<div class="panel panel-danger mt16">
<div class="panel-heading clearfix">
<span class="pull-left">Invalid or expired coupon code</span>