Browse Source

[ADD] Extended The features

pull/29/head
SHEREEF PT 8 years ago
parent
commit
06e8411534
  1. 28
      website_coupon/README.rst
  2. 6
      website_coupon/__init__.py
  3. 15
      website_coupon/__manifest__.py
  4. 21
      website_coupon/controllers/__init__.py
  5. 83
      website_coupon/controllers/main.py
  6. 1
      website_coupon/data/product_data.xml
  7. 7
      website_coupon/models/__init__.py
  8. 17
      website_coupon/models/gift_voucher.py
  9. 94
      website_coupon/static/description/index.html
  10. BIN
      website_coupon/static/description/unable_to_update.png
  11. BIN
      website_coupon/static/description/voucher.png
  12. BIN
      website_coupon/static/description/voucher_all.png
  13. BIN
      website_coupon/static/description/voucher_category.png
  14. BIN
      website_coupon/static/description/voucher_product.png
  15. 6
      website_coupon/views/gift_voucher.xml
  16. 11
      website_coupon/views/templates.xml

28
website_coupon/README.rst

@ -1,17 +1,35 @@
Website Coupon Code v10 Website Coupon Code v10
======================= =======================
Manage Website Coupon Codes & Its Operations Manage Website Coupon Codes for Products/Categories/All Products & Its Redeem Operations
Features Features(base version: 10.0.1)
======== ==============================
* Create and configure vouchers for providing a discount. * Create and configure vouchers for providing a discount for a single product.
* Generate a unique code for each coupon. * Generate a unique code for each coupon.
* Limit the usage of coupons by each user. * Limit the usage of coupons by each user.
* Provide a validity for the coupons. * Provide a validity for the coupons.
* History of coupons used by each customer. * History of coupons used by each customer.
Additional Features (version: 10.0.2)
=====================================
* Create and configure vouchers for a category of products.
* Create and configure vouchers for all the products.
* The coupon cannot be applied, if the coupon value is greater than the total amount of an order.
Installation
============
Just select it from available modules to install it, there is no need to extra installations.
Configuration
=============
After installing the module, go to sales and create vouchers from the vouchers menu. After voucher is created, we can
generate the coupons related to this voucher. Now go to website, go to cart and under the customize menu, enable the
voucher code option.
Credits Credits
======= =======
Cybrosys Techno Solutions, <http://www.cybrosys.com> Developer: Linto CT @ cybrosys, linto@cybrosys.in

6
website_coupon/__init__.py

@ -2,8 +2,8 @@
############################################################################## ##############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). # Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>) # Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
@ -17,7 +17,7 @@
# #
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. # GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################

15
website_coupon/__manifest__.py

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). # Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>) # Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
@ -17,19 +18,19 @@
# #
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. # GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
{ {
'name': 'Website Coupon Code', 'name': 'Website Coupon Code',
'version': '10.0.1.0.0', 'version': '10.0.2.0',
'category': 'Website', 'category': 'Website',
'sequence': 56, 'sequence': 56,
'summary': 'Manage Website Coupon Codes & Its Operations', 'summary': 'Manage Website Coupon Codes for Products/Categories/All Products & Its Redeem Operations',
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
'website': 'http://www.cybrosys.com',
'depends': ['sale', 'website_sale'], 'depends': ['sale', 'website_sale'],
'website': 'http://www.cybrosys.com',
'data': [ 'data': [
'data/product_data.xml', 'data/product_data.xml',
'views/gift_voucher.xml', 'views/gift_voucher.xml',
@ -37,7 +38,5 @@
'views/templates.xml', 'views/templates.xml',
], ],
'installable': True, 'installable': True,
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'auto_install': False, 'auto_install': False,
} }

21
website_coupon/controllers/__init__.py

@ -1,24 +1,3 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import main import main

83
website_coupon/controllers/main.py

@ -1,25 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import http, tools, _ from odoo import http, tools, _
from odoo.http import request from odoo.http import request
@ -60,7 +39,6 @@ class WebsiteCoupon(http.Controller):
values['code_not_available'] = post.get('code_not_available') values['code_not_available'] = post.get('code_not_available')
elif post.get('coupon_not_available'): elif post.get('coupon_not_available'):
values['coupon_not_available'] = post.get('coupon_not_available') values['coupon_not_available'] = post.get('coupon_not_available')
return request.render("website_sale.cart", values) return request.render("website_sale.cart", values)
@http.route(['/shop/gift_coupon'], type='http', auth="public", website=True) @http.route(['/shop/gift_coupon'], type='http', auth="public", website=True)
@ -98,7 +76,7 @@ class WebsiteCoupon(http.Controller):
else: else:
flag = False flag = False
if flag: if flag:
product_id = coupon.voucher.product_id voucher_type = coupon.voucher.voucher_type
voucher_val = coupon.voucher_val voucher_val = coupon.voucher_val
type = coupon.type type = coupon.type
coupon_product = request.env['product.product'].sudo().search([('name', '=', 'Gift Coupon')], limit=1) coupon_product = request.env['product.product'].sudo().search([('name', '=', 'Gift Coupon')], limit=1)
@ -109,29 +87,50 @@ class WebsiteCoupon(http.Controller):
if line.product_id.name == 'Gift Coupon': if line.product_id.name == 'Gift Coupon':
flag = False flag = False
break break
if line.product_id.name == product_id.name: if flag and order.order_line:
flag_product = True if voucher_type == 'product':
if flag and flag_product: # the voucher type is product ----------------------------
if type == 'fixed': categ_id = coupon.voucher.product_id
res = coupon_product.product_tmpl_id.write({'list_price': -voucher_val})
elif type == 'percentage':
amount = 0
for line in order.order_line: for line in order.order_line:
amount += line.product_uom_qty * line.price_unit if line.product_id.name == categ_id.name:
amount_final = (voucher_val/100) * amount flag_product = True
elif voucher_type == 'category':
# the voucher type is category ----------------------------
product_id = coupon.voucher.product_categ
for line in order.order_line:
if line.product_id.categ_id.name == product_id.name:
flag_product = True
elif voucher_type == 'all':
# the voucher is applicable to all products ----------------------------
flag_product = True
if flag_product:
# the voucher is applicable --------------------------------------
if type == 'fixed':
# coupon type is 'fixed'--------------------------------------
if voucher_val < order.amount_total:
res = coupon_product.product_tmpl_id.write({'list_price': -voucher_val})
else:
return request.redirect("/shop/cart?coupon_not_available=3")
elif type == 'percentage':
# coupon type is percentage -------------------------------------
amount_final = (voucher_val/100) * order.amount_total
res = coupon_product.product_tmpl_id.write({'list_price': -amount_final}) 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--------------
total = coupon.total_avail - 1 total = coupon.total_avail - 1
coupon.write({'total_avail': total}) coupon.write({'total_avail': total})
# creating a record for this partner, i.e he is used this coupen once----------- # creating a record for this partner, i.e he is used this coupon once-----------
if not applied_coupons: if not applied_coupons:
res = curr_user.partner_id.write({'applied_coupon': [(0, 0, {'partner_id': curr_user.partner_id.id, res = curr_user.partner_id.write({'applied_coupon': [(0, 0, {'partner_id': curr_user.partner_id.id,
'coupon': coupon.code, 'coupon': coupon.code,
'number': 1})]}) 'number': 1})]})
else:
applied_coupons.write({'number': applied_coupons.number + 1})
else: else:
applied_coupons.write({'number': applied_coupons.number + 1}) return request.redirect("/shop/cart?coupon_not_available=1")
else:
return request.redirect("/shop/cart?coupon_not_available=2")
else: else:
return request.redirect("/shop/cart?coupon_not_available=1") return request.redirect("/shop/cart?coupon_not_available=1")

1
website_coupon/data/product_data.xml

@ -2,7 +2,6 @@
<odoo noupdate="1"> <odoo noupdate="1">
<record model="product.product" id="discount_product"> <record model="product.product" id="discount_product">
<field name="name">Gift Coupon</field> <field name="name">Gift Coupon</field>
<!--<field name="type">service</field>-->
</record> </record>
</odoo> </odoo>

7
website_coupon/models/__init__.py

@ -2,8 +2,8 @@
############################################################################## ##############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). # Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>) # Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
@ -17,8 +17,7 @@
# #
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. # GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import gift_voucher import gift_voucher

17
website_coupon/models/gift_voucher.py

@ -2,8 +2,8 @@
############################################################################## ##############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). # Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>) # Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
@ -17,10 +17,9 @@
# #
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. # GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import string import string
import random import random
from odoo import models, fields, api, _ from odoo import models, fields, api, _
@ -31,7 +30,15 @@ class GiftVoucher(models.Model):
_name = 'gift.voucher' _name = 'gift.voucher'
name = fields.Char(string="Name", required=True) name = fields.Char(string="Name", required=True)
product_id = fields.Many2one('product.product', string="Product", required=True) voucher_type = fields.Selection(
selection=[
('product', 'Product'),
('category', 'Product Category'),
('all', 'All Products'),
], string="Applicable on ", default='product'
)
product_id = fields.Many2one('product.product', string="Product")
product_categ = fields.Many2one('product.category', string="Product Category")
min_value = fields.Integer(string="Minimum Voucher Value", required=True) min_value = fields.Integer(string="Minimum Voucher Value", required=True)
max_value = fields.Integer(string="Maximum Voucher Value", required=True) max_value = fields.Integer(string="Maximum Voucher Value", required=True)
expiry_date = fields.Date(string="Expiry Date", required=True) expiry_date = fields.Date(string="Expiry Date", required=True)

94
website_coupon/static/description/index.html

@ -1,10 +1,10 @@
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<h2 class="oe_slogan">Website Coupon</h2> <h2 class="oe_slogan">Website Coupon</h2>
<h3 class="oe_slogan">..Manage Your Coupon Codes Simply..</h3> <h3 class="oe_slogan">..Manage Your Coupons Simply..</h3>
<h4 class="oe_slogan">Cybrosys Technologies , www.cybrosys.com</h4> <h4 class="oe_slogan">Cybrosys Technologies , www.cybrosys.com</h4>
<div> <div>
<p class='oe_mt32' style="text-align: center;"> <p class='oe_mt32' >
This module by Cybrosys Technologies allows us to manage our customers in a better way by providing This module by Cybrosys Technologies allows us to manage our customers in a better way by providing
discount coupons to our special customers, and thereby increase the sales. discount coupons to our special customers, and thereby increase the sales.
</div> </div>
@ -16,7 +16,7 @@
<h2 style="color:#875A7B;">Features</h2> <h2 style="color:#875A7B;">Features</h2>
<div class="oe_span6 text-justify oe_mt32"> <div class="oe_span6 text-justify oe_mt32">
<p class="oe_mb32" style="margin-left:48px;"> <p class="oe_mb32" style="margin-left:48px;">
&#x261B; Create and configure vouchers for providing a discount. &#x261B; Create and configure vouchers for providing a discount based on product, product category or for all products.
</p> </p>
<p class="oe_mb32" style="margin-left:48px;"> <p class="oe_mb32" style="margin-left:48px;">
&#x261B; Generate a unique code for each coupon. &#x261B; Generate a unique code for each coupon.
@ -57,9 +57,19 @@
</div> </div>
<p class="oe_mt32" style="margin-left:48px;"> <p class="oe_mt32" style="margin-left:48px;">
After enabling the 'Voucher Code' option, we can enter our coupon code. If that code is valid, After enabling the 'Voucher Code' option, we can enter our coupon code. If that code is valid,
it will be applied to the order. it will be applied to the order. The validation is based on the expiry date of the voucher,
the voucher type, coupon code entered, coupon balance, etc.
The total amount of an order can't be zero or less than, zero. After we have
entered the coupon code and pressed the apply button, the system will check the amount after
applying the coupon specified is greater than zero or not. If not, we cannot apply this coupon to this order.
In this case we will see a notification saying that this coupon is not applicable.
</p> </p>
</div> </div>
<div class="oe_span6" style="align-content: center;">
<div class="oe_demo oe_screenshot">
<img src="unable_to_update.png">
</div>
</div>
</div> </div>
</section> </section>
@ -67,14 +77,34 @@
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_span12"> <div class="oe_span12">
<h3 class="oe_slogan">Create and configure vouchers.</h3> <h3 class="oe_slogan">Create and configure vouchers.</h3>
<div class="oe_demo oe_screenshot">
<img src="voucher.png">
</div>
<p class="oe_mt32" style="margin-left:48px;"> <p class="oe_mt32" style="margin-left:48px;">
For creating a voucher, we need to specify a product, that means, this voucher will be applicable only For creating a voucher, there are three options. We can create a voucher for a single product or a product category
or for the complete products. For the first option, we need to specify a product, that means, this voucher will be applicable only
if the customer has selected this product in his order. The minimum and maximum voucher values can be set here. if the customer has selected this product in his order. The minimum and maximum voucher values can be set here.
The expiry date indicates the validity of this voucher. The expiry date indicates the validity of this voucher.
</p> </p>
<p class="oe_mt32" style="margin-left:48px;">
For creating voucher for a product category, we need to select a category. In
this case, this voucher will be applicable only if the cart contains products from this category.
</p>
<p class="oe_mt32" style="margin-left:48px;">
The third option can be used to provide discounts for all the products.
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_screenshot">
<img src="voucher_product.png">
</div>
</div>
<div class="oe_span6">
<div class="oe_demo oe_screenshot">
<img src="voucher_category.png">
</div>
</div>
<div class="oe_span6">
<div class="oe_demo oe_screenshot">
<img src="voucher_all.png">
</div>
</div> </div>
</div> </div>
</section> </section>
@ -113,28 +143,28 @@
</div> </div>
</section> </section>
<section class="oe_container"> <section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> <h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;"> <div class="oe_slogan" style="margin-top:10px !important;">
<div> <div>
<a class="btn btn-primary btn-lg mt8" <a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="http://www.cybrosys.com"><i style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="http://www.cybrosys.com/contact/"><i href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a> class="fa fa-check-square"></i> Request Customization </a>
</div> </div>
<br> <br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> <img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div> <div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> <a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> <a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> <a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> <a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> <a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div> </div>
</div> </div>
</section> </section>

BIN
website_coupon/static/description/unable_to_update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
website_coupon/static/description/voucher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

BIN
website_coupon/static/description/voucher_all.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
website_coupon/static/description/voucher_category.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
website_coupon/static/description/voucher_product.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

6
website_coupon/views/gift_voucher.xml

@ -10,7 +10,11 @@
<group> <group>
<group> <group>
<field name="name" /> <field name="name" />
<field name="product_id" /> <field name="voucher_type" widget="radio"/>
<field name="product_id" attrs="{'invisible': [('voucher_type', 'in', ('category','all'))],
'required':[('voucher_type', '=', 'product')]}"/>
<field name="product_categ" attrs="{'invisible': [('voucher_type', 'in', ('product','all'))],
'required':[('voucher_type', '=', 'category')]}"/>
<field name="min_value" /> <field name="min_value" />
<field name="max_value" /> <field name="max_value" />
<field name="expiry_date" /> <field name="expiry_date" />

11
website_coupon/views/templates.xml

@ -7,7 +7,15 @@
Have a voucher code? Fill this field and apply. Have a voucher code? Fill this field and apply.
</p> </p>
<t t-if="coupon_not_available"> <t t-if="coupon_not_available">
<p class="bg-warning">This gift code is not available</p> <t t-if="coupon_not_available=='1'">
<p class="bg-warning">This gift code is not available</p>
</t>
<t t-if="coupon_not_available=='2'">
<p class="bg-warning">This gift code is not available</p>
</t>
<t t-if="coupon_not_available=='3'">
<p class="bg-warning">The discount amount is too large</p>
</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" action="/shop/gift_coupon" method="post" class="mb32">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" /> <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
@ -84,6 +92,7 @@
</t> </t>
</tbody> </tbody>
</table> </table>
</xpath> </xpath>
</template> </template>
</odoo> </odoo>
Loading…
Cancel
Save