|
@ -113,8 +113,19 @@ class WebsiteCoupon(http.Controller): |
|
|
return request.redirect("/shop/cart?coupon_not_available=3") |
|
|
return request.redirect("/shop/cart?coupon_not_available=3") |
|
|
elif type == 'percentage': |
|
|
elif type == 'percentage': |
|
|
# coupon type is percentage ------------------------------------- |
|
|
# coupon type is percentage ------------------------------------- |
|
|
amount_final = (voucher_val/100) * order.amount_total |
|
|
if voucher_type == 'product': |
|
|
res = coupon_product.product_tmpl_id.write({'list_price': -amount_final}) |
|
|
for line in order.order_line: |
|
|
|
|
|
if line.product_id.name == categ_id.name: |
|
|
|
|
|
amount_final = (voucher_val / 100) * line.price_total |
|
|
|
|
|
break |
|
|
|
|
|
elif voucher_type == 'category': |
|
|
|
|
|
amount_final = 0 |
|
|
|
|
|
for line in order.order_line: |
|
|
|
|
|
if line.product_id.categ_id.name == product_id.name: |
|
|
|
|
|
amount_final += (voucher_val / 100) * line.price_total |
|
|
|
|
|
elif voucher_type == 'all': |
|
|
|
|
|
amount_final = (voucher_val/100) * order.amount_total |
|
|
|
|
|
res = coupon_product.product_tmpl_id.write({'list_price': -amount_final}) |
|
|
value = order._cart_update(product_id=coupon_product.id, set_qty=1, add_qty=1) |
|
|
value = order._cart_update(product_id=coupon_product.id, set_qty=1, add_qty=1) |
|
|
|
|
|
|
|
|
# updating coupon balance-------------- |
|
|
# updating coupon balance-------------- |
|
|