Browse Source

[FIX] Bug Fixed 'website_coupon'

pull/150/head
Ajmal JK 5 years ago
parent
commit
350f454128
  1. 2
      website_coupon/__manifest__.py
  2. 5
      website_coupon/controllers/main.py
  3. 3
      website_coupon/data/product_data.xml

2
website_coupon/__manifest__.py

@ -20,7 +20,7 @@
##############################################################################
{
'name': 'Website Coupon Code',
'version': '12.0.2.0.1',
'version': '12.0.2.1.2',
'summary': 'Manage Website Coupon Codes for Products/Categories/All Products & Its Redeem Operations',
'category': 'Website',
'author': 'Cybrosys Techno Solutions',

5
website_coupon/controllers/main.py

@ -87,12 +87,12 @@ class WebsiteCoupon(WebsiteSale):
voucher_type = coupon.voucher.voucher_type
voucher_val = coupon.voucher_val
type = coupon.type
coupon_product = request.env['product.product'].sudo().search([('name', '=', 'Gift Coupon')], limit=1)
coupon_product = request.env['product.product'].sudo().search([('default_code', '=', 'gift_coupon')], limit=1)
if coupon_product:
order = request.website.sale_get_order(force_create=1)
flag_product = False
for line in order.order_line:
if line.product_id.name == 'Gift Coupon':
if line.product_id.default_code == 'gift_coupon':
flag = False
break
if flag and order.order_line:
@ -175,7 +175,6 @@ class WebsiteCoupon(WebsiteSale):
for data in sales_order:
products.append(data.name)
if 'Gift Coupon' in products:
print("gigt coupon in products")
total = coupon.total_avail - 1
coupon.write({'total_avail': total})
if not applied_coupons:

3
website_coupon/data/product_data.xml

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<odoo>
<record model="product.product" id="discount_product">
<field name="name">Gift Coupon</field>
<field name="default_code">gift_coupon</field>
</record>
</odoo>

Loading…
Cancel
Save