From 350f454128d3ecd7dbceaa15baa41100027e4ef0 Mon Sep 17 00:00:00 2001 From: Ajmal JK Date: Thu, 14 May 2020 15:24:31 +0530 Subject: [PATCH] [FIX] Bug Fixed 'website_coupon' --- website_coupon/__manifest__.py | 2 +- website_coupon/controllers/main.py | 5 ++--- website_coupon/data/product_data.xml | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/website_coupon/__manifest__.py b/website_coupon/__manifest__.py index 2328f8e8a..37558a0fa 100644 --- a/website_coupon/__manifest__.py +++ b/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', diff --git a/website_coupon/controllers/main.py b/website_coupon/controllers/main.py index aa583c29f..50b9d92a3 100644 --- a/website_coupon/controllers/main.py +++ b/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: diff --git a/website_coupon/data/product_data.xml b/website_coupon/data/product_data.xml index 86681ee15..1db21f9c3 100644 --- a/website_coupon/data/product_data.xml +++ b/website_coupon/data/product_data.xml @@ -1,6 +1,7 @@ - + Gift Coupon + gift_coupon