Browse Source

[ADD] Initial Commit

pull/124/head
Ajmalcybrosys 6 years ago
parent
commit
7d5c2e1ae4
  1. 54
      website_coupon/README.rst
  2. 25
      website_coupon/__init__.py
  3. 46
      website_coupon/__manifest__.py
  4. 3
      website_coupon/controllers/__init__.py
  5. 155
      website_coupon/controllers/main.py
  6. 6
      website_coupon/data/product_data.xml
  7. 6
      website_coupon/doc/RELEASE_NOTES.md
  8. 315
      website_coupon/i18n/fr.po
  9. 23
      website_coupon/models/__init__.py
  10. 91
      website_coupon/models/gift_voucher.py
  11. 10
      website_coupon/security/ir.model.access.csv
  12. BIN
      website_coupon/static/description/apply_coupon.png
  13. BIN
      website_coupon/static/description/banner.jpg
  14. BIN
      website_coupon/static/description/coupon.png
  15. BIN
      website_coupon/static/description/cybro_logo.png
  16. BIN
      website_coupon/static/description/enable_voucher.png
  17. BIN
      website_coupon/static/description/history.png
  18. 361
      website_coupon/static/description/index.html
  19. BIN
      website_coupon/static/description/unable_to_update.png
  20. BIN
      website_coupon/static/description/voucher_all.png
  21. BIN
      website_coupon/static/description/voucher_category.png
  22. BIN
      website_coupon/static/description/voucher_product.png
  23. BIN
      website_coupon/static/src/img/icon.png
  24. 46
      website_coupon/views/applied_coupons.xml
  25. 126
      website_coupon/views/gift_voucher.xml
  26. 52
      website_coupon/views/templates.xml

54
website_coupon/README.rst

@ -0,0 +1,54 @@
Website Coupon Code v12
=======================
Manage Website Coupon Codes for Products/Categories/All Products & Its Redeem Operations
Features
========
* Create and configure vouchers for providing a discount for a single product.
* Generate a unique code for each coupon.
* Limit the usage of coupons by each user.
* Provide a validity for the coupons.
* History of coupons used by each customer.
* 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
============
- www.odoo.com/documentation/12.0/setup/install.html
- Install our custom addon
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.
License
=======
GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (LGPLv3)
(http://www.gnu.org/licenses/agpl.html)
Bug Tracker
===========
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
Credits
=======
* Cybrosys Techno Solutions<https://www.cybrosys.com>
Author
------
Developer:v11- Linto CT @ cybrosys, odoo@cybrosys.com
v12- Meera K
Maintainer
----------
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com.

25
website_coupon/__init__.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://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 <https://www.gnu.org/licenses/>.
#
##############################################################################
from . import models
from . import controllers

46
website_coupon/__manifest__.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://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/>.
#
##############################################################################
{
'name': 'Website Coupon Code',
'version': '12.0.1.0.0',
'summary': 'Manage Website Coupon Codes for Products/Categories/All Products & Its Redeem Operations',
'category': 'Website',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'depends': ['sale_management', 'website_sale'],
'website': 'https://www.cybrosys.com',
'data': [
'data/product_data.xml',
'views/gift_voucher.xml',
'views/applied_coupons.xml',
'views/templates.xml',
'security/ir.model.access.csv'
],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

3
website_coupon/controllers/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import main

155
website_coupon/controllers/main.py

@ -0,0 +1,155 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from odoo import fields, http, tools, _
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
class WebsiteCoupon(WebsiteSale):
@http.route(['/shop/cart'], type='http', auth="public", website=True)
def cart(self, access_token=None, revive='', **post):
order = request.website.sale_get_order()
if order and order.state != 'draft':
request.session['sale_order_id'] = None
order = request.website.sale_get_order()
values = {}
if order:
from_currency = order.company_id.currency_id
to_currency = order.pricelist_id.currency_id
compute_currency = lambda price: from_currency._convert(
price, to_currency, request.env.user.company_id, fields.Date.today())
else:
compute_currency = lambda price: price
values.update({
'website_sale_order': order,
'compute_currency': compute_currency,
'date': fields.Date.today(),
'suggested_products': [],
})
if order:
_order = order
if not request.env.context.get('pricelist'):
_order = order.with_context(pricelist=order.pricelist_id.id)
values['suggested_products'] = _order._cart_accessories()
if post.get('type') == 'popover':
return request.render("website_sale.cart_popover", values, headers={'Cache-Control': 'no-cache'})
if post.get('code_not_available'):
values['code_not_available'] = post.get('code_not_available')
elif post.get('coupon_not_available'):
values['coupon_not_available'] = post.get('coupon_not_available')
return request.render("website_sale.cart", values)
@http.route(['/shop/gift_coupon'], type='http', auth="public", website=True)
def gift_coupon(self, promo_voucher, **post):
"""This function will be executed when we click the apply button of the voucher code in the website.
It will verify the validity and availability of that coupon. If it can be applied, the coupon will be applied
and coupon balance will also be updated"""
curr_user = request.env.user
coupon = request.env['gift.coupon'].sudo().search([('code', '=', promo_voucher)], limit=1)
flag = True
if coupon and coupon.total_avail > 0:
applied_coupons = request.env['partner.coupon'].sudo().search([('coupon', '=', promo_voucher),
('partner_id', '=', curr_user.partner_id.id)], limit=1)
# checking voucher date and limit for each user for this coupon---------------------
if coupon.partner_id:
if curr_user.partner_id.id != coupon.partner_id.id:
flag = False
today = datetime.now().date()
if flag and applied_coupons.number < coupon.limit and today <= coupon.voucher.expiry_date:
# checking coupon validity ---------------------------
# checking date of coupon ------------
if coupon.start_date and coupon.end_date:
if today < coupon.start_date or today > coupon.end_date:
flag = False
elif coupon.start_date:
if today < coupon.start_date:
flag = False
elif coupon.end_date:
if today > coupon.end_date:
flag = False
else:
flag = False
else:
flag = False
if flag:
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)
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':
flag = False
break
if flag and order.order_line:
if voucher_type == 'product':
# the voucher type is product ----------------------------
categ_id = coupon.voucher.product_id
for line in order.order_line:
if line.product_id.name == categ_id.name:
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:
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 = 0
if voucher_type == 'product':
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':
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
coupon_product.product_tmpl_id.write({'list_price': -amount_final})
order._cart_update(product_id=coupon_product.id, set_qty=1, add_qty=1)
# updating coupon balance--------------
total = coupon.total_avail - 1
coupon.write({'total_avail': total})
# creating a record for this partner, i.e he is used this coupon once-----------
if not applied_coupons:
curr_user.partner_id.write({'applied_coupon': [(0, 0, {'partner_id': curr_user.partner_id.id,
'coupon': coupon.code,
'number': 1})]})
else:
applied_coupons.write({'number': applied_coupons.number + 1})
else:
return request.redirect("/shop/cart?coupon_not_available=1")
else:
return request.redirect("/shop/cart?coupon_not_available=2")
else:
return request.redirect("/shop/cart?coupon_not_available=1")
return request.redirect("/shop/cart")

6
website_coupon/data/product_data.xml

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

6
website_coupon/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <website_coupon>
#### 02.04.2019
#### Version 12.0.1.0.0
Initial Commit for Website Coupon.

315
website_coupon/i18n/fr.po

@ -0,0 +1,315 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_coupon
#
# Xavier Brochard <xavier@alternatif.org>, 2017.
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0-20171109\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-17 11:24+0000\n"
"PO-Revision-Date: 2017-11-17 15:04+0100\n"
"Last-Translator: Xavier Brochard <xavier@alternatif.org>\n"
"Language-Team: French <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"Language: fr\n"
"X-Generator: Lokalize 2.0\n"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.cart_lines_extended
msgid "<small><i class=\"fa fa-trash-o\"/> Remove</small>"
msgstr "<small><i class=\"fa fa-trash-o\"/> Enlever</small>"
#. module: website_coupon
#: selection:gift.voucher,voucher_type:0
msgid "All Products"
msgstr "Tous les articles"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_voucher_type
msgid "Applicable on "
msgstr "Valable sur"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.applied_coupons_view
msgid "Applied Coupons"
msgstr ""
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.voucher_code
msgid "Apply"
msgstr "Valider"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_code
msgid "Code"
msgstr ""
#. module: website_coupon
#: sql_constraint:gift.coupon:0
msgid "Code already exists !"
msgstr "Ce code existe déjà!"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.gift_coupon_form
msgid "Conditions"
msgstr "Restrictions obligatoires"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_coupon
msgid "Coupon Applied"
msgstr "Code utilisé"
#. module: website_coupon
#: model:ir.ui.menu,name:website_coupon.gift_coupon_history
msgid "Coupon History"
msgstr "Utilisation"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_res_partner_applied_coupon
#: model:ir.model.fields,field_description:website_coupon.field_res_users_applied_coupon
msgid "Coupons Applied"
msgstr ""
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_create_uid
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_create_uid
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_create_uid
msgid "Created by"
msgstr ""
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_create_date
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_create_date
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_create_date
msgid "Created on"
msgstr ""
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_display_name
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_display_name
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_end_date
msgid "End Date"
msgstr "Finit le"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_expiry_date
msgid "Expiry Date"
msgstr "Expire le"
#. module: website_coupon
#: selection:gift.coupon,type:0
msgid "Fixed Amount"
msgstr "Montant fixe"
#. module: website_coupon
#: model:ir.actions.act_window,name:website_coupon.action_gift_coupon
msgid "Generate Gift Coupons"
msgstr "Créer des codes promotionnels"
#. module: website_coupon
#: model:ir.ui.menu,name:website_coupon.gift_coupon
#: model:product.product,name:website_coupon.discount_product
#: model:product.template,name:website_coupon.discount_product_product_template
msgid "Gift Coupon"
msgstr "Code promotionel"
#. module: website_coupon
#: model:ir.ui.menu,name:website_coupon.gift_coupon_main
msgid "Gift Coupons"
msgstr "Codes promo"
#. module: website_coupon
#: model:ir.actions.act_window,name:website_coupon.action_gift_coupon_history
msgid "Gift Coupons History"
msgstr "Promotions utilisées"
#. module: website_coupon
#: model:ir.ui.menu,name:website_coupon.gift_voucher
msgid "Gift Voucher"
msgstr "Promotions autorisées"
#. module: website_coupon
#: model:ir.actions.act_window,name:website_coupon.action_gift_voucher
msgid "Gift Vouchers"
msgstr "Promotions autorisées"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.voucher_code
msgid "Have a voucher code? Fill this field and apply."
msgstr "Vous avez un code de réduction ? Remplissez ce champ et validez."
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_id
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_id
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_id
msgid "ID"
msgstr ""
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon___last_update
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher___last_update
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon___last_update
msgid "Last Modified on"
msgstr ""
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_write_uid
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_write_uid
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_write_uid
msgid "Last Updated by"
msgstr ""
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_write_date
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_write_date
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_write_date
msgid "Last Updated on"
msgstr ""
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_partner_id
msgid "Limit to a Single Partner"
msgstr "Limiter au contact"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_max_value
msgid "Maximum Voucher Value"
msgstr "Valeur de calcul maximum"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_min_value
msgid "Minimum Voucher Value"
msgstr "Valeur de calcul minimum"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_name
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_name
#: model:ir.ui.view,arch_db:website_coupon.gift_coupon_form
msgid "Name"
msgstr "Nom"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_number
msgid "Number of Times Used"
msgstr "Nombre de fois"
#. module: website_coupon
#: model:ir.model,name:website_coupon.model_res_partner
#: model:ir.model.fields,field_description:website_coupon.field_partner_coupon_partner_id
msgid "Partner"
msgstr "Contact"
#. module: website_coupon
#: selection:gift.coupon,type:0
msgid "Percentage"
msgstr "Pourcentage"
#. module: website_coupon
#: code:addons/website_coupon/models/gift_voucher.py:77
#, python-format
msgid "Please check the voucher value"
msgstr ""
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.cart_lines_extended
msgid "Price"
msgstr "Prix"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.gift_coupon_form
msgid "Pricing"
msgstr "Montant"
#. module: website_coupon
#: selection:gift.voucher,voucher_type:0
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_product_id
#: model:ir.ui.view,arch_db:website_coupon.cart_lines_extended
msgid "Product"
msgstr "Article"
#. module: website_coupon
#: selection:gift.voucher,voucher_type:0
#: model:ir.model.fields,field_description:website_coupon.field_gift_voucher_product_categ
msgid "Product Category"
msgstr "Catégorie d'articles"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.cart_lines_extended
msgid "Quantity"
msgstr "Quantité"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_start_date
msgid "Start Date"
msgstr "Débute le"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.voucher_code
msgid "The discount amount is too large"
msgstr ""
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.voucher_code
msgid "This gift code is not available"
msgstr "Ce code n'est pas valable"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_total_avail
msgid "Total Available"
msgstr "Quantité totale disponible"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_limit
msgid "Total Available For Each User"
msgstr "Quantité maxi par personne"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_type
msgid "Type"
msgstr ""
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_voucher
msgid "Voucher"
msgstr "Autorisation"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.voucher_code
msgid "Voucher Code"
msgstr "Code promo"
#. module: website_coupon
#: model:ir.model.fields,field_description:website_coupon.field_gift_coupon_voucher_val
msgid "Voucher Value"
msgstr "Valeur de calcul"
#. module: website_coupon
#: model:ir.ui.view,arch_db:website_coupon.voucher_code
msgid "code..."
msgstr ""
#. module: website_coupon
#: model:ir.model,name:website_coupon.model_gift_coupon
msgid "gift.coupon"
msgstr ""
#. module: website_coupon
#: model:ir.model,name:website_coupon.model_gift_voucher
msgid "gift.voucher"
msgstr ""
#. module: website_coupon
#: model:ir.model,name:website_coupon.model_partner_coupon
msgid "partner.coupon"
msgstr ""

23
website_coupon/models/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://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 <https://www.gnu.org/licenses/>.
#
##############################################################################
from . import gift_voucher

91
website_coupon/models/gift_voucher.py

@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://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 <https://www.gnu.org/licenses/>.
#
##############################################################################
import string
import random
from odoo import models, fields, api, _
from datetime import datetime,date
from odoo.exceptions import UserError
class GiftVoucher(models.Model):
_name = 'gift.voucher'
name = fields.Char(string="Name", 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)
max_value = fields.Integer(string="Maximum Voucher Value", required=True)
expiry_date = fields.Date(string="Expiry Date", required=True)
class GiftCoupon(models.Model):
_name = 'gift.coupon'
def get_code(self):
size = 7
chars = string.ascii_uppercase + string.digits
return ''.join(random.choice(chars) for _ in range(size))
_sql_constraints = [
('name_uniq', 'unique (code)', "Code already exists !"),
]
name = fields.Char(string="Name", required=True)
code = fields.Char(string="Code", default=get_code)
voucher = fields.Many2one('gift.voucher', string="Voucher", required=True)
start_date = fields.Date(string="Start Date")
end_date = fields.Date(string="End Date")
partner_id = fields.Many2one('res.partner', string="Limit to a Single Partner")
limit = fields.Integer(string="Total Available For Each User", default=1)
total_avail = fields.Integer(string="Total Available", default=1)
voucher_val = fields.Float(string="Voucher Value")
type = fields.Selection([
('fixed', 'Fixed Amount'),
('percentage', 'Percentage'),
], store=True, default='fixed')
@api.onchange('voucher_val')
def check_val(self):
if self.voucher_val > self.voucher.max_value or self.voucher_val < self.voucher.min_value:
raise UserError(_("Please check the voucher value"))
class CouponPartner(models.Model):
_name = 'partner.coupon'
partner_id = fields.Many2one('res.partner', string="Partner")
coupon = fields.Char(string="Coupon Applied")
number = fields.Integer(string="Number of Times Used")
class PartnerExtended(models.Model):
_inherit = 'res.partner'
applied_coupon = fields.One2many('partner.coupon', 'partner_id', string="Coupons Applied")

10
website_coupon/security/ir.model.access.csv

@ -0,0 +1,10 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_website_coupon_voucher,website_coupon_gift_voucher,model_gift_voucher,sales_team.group_sale_manager,1,1,1,1
access_website_coupon_coupon,website_coupon_gift_coupon,model_gift_coupon,sales_team.group_sale_manager,1,1,1,1
access_website_coupon_partner,website_coupon_partner_coupon,model_partner_coupon,sales_team.group_sale_manager,1,1,1,1
access_website_voucher_user1,website_coupon_voucher_usr1,model_gift_voucher,sales_team.group_sale_salesman_all_leads,1,0,0,0
access_website_coupon_usr1,website_gift_coupon_usr1,model_gift_coupon,sales_team.group_sale_salesman_all_leads,1,0,0,0
access_website_coupon_partner_usr1,website_coupon_partner_usr1,model_partner_coupon,sales_team.group_sale_salesman_all_leads,1,0,0,0
access_website_voucher_user2,website_coupon_voucher_usr2,model_gift_voucher,sales_team.group_sale_salesman,1,0,0,0
access_website_coupon_usr2,website_gift_coupon_usr2,model_gift_coupon,sales_team.group_sale_salesman,1,0,0,0
access_website_coupon_partner_usr2,website_coupon_partner_usr2,model_partner_coupon,sales_team.group_sale_salesman,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_website_coupon_voucher website_coupon_gift_voucher model_gift_voucher sales_team.group_sale_manager 1 1 1 1
3 access_website_coupon_coupon website_coupon_gift_coupon model_gift_coupon sales_team.group_sale_manager 1 1 1 1
4 access_website_coupon_partner website_coupon_partner_coupon model_partner_coupon sales_team.group_sale_manager 1 1 1 1
5 access_website_voucher_user1 website_coupon_voucher_usr1 model_gift_voucher sales_team.group_sale_salesman_all_leads 1 0 0 0
6 access_website_coupon_usr1 website_gift_coupon_usr1 model_gift_coupon sales_team.group_sale_salesman_all_leads 1 0 0 0
7 access_website_coupon_partner_usr1 website_coupon_partner_usr1 model_partner_coupon sales_team.group_sale_salesman_all_leads 1 0 0 0
8 access_website_voucher_user2 website_coupon_voucher_usr2 model_gift_voucher sales_team.group_sale_salesman 1 0 0 0
9 access_website_coupon_usr2 website_gift_coupon_usr2 model_gift_coupon sales_team.group_sale_salesman 1 0 0 0
10 access_website_coupon_partner_usr2 website_coupon_partner_usr2 model_partner_coupon sales_team.group_sale_salesman 1 0 0 0

BIN
website_coupon/static/description/apply_coupon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
website_coupon/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
website_coupon/static/description/coupon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
website_coupon/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
website_coupon/static/description/enable_voucher.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
website_coupon/static/description/history.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

361
website_coupon/static/description/index.html

@ -0,0 +1,361 @@
<section class="oe_container" style="background-image:url(https://www.cybrosys.com/images/odoo-index-header-banner.png); background-repeat:no-repeat; background-size:cover;padding: 13% 0% 22% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="font-size: 35px;color: #fff;font-weight: 900;text-transform: uppercase;text-align: left;margin: 0;margin-bottom: 16px;">
Website Coupon
</h2>
<h3 class="oe_slogan" style="font-size: 25px;color: #fff;font-weight: 600;text-align: left;opacity: 1;margin: 0 !important;">
..Manage Your Coupons Simply..
</h3>
<h5 class="oe_slogan" style="text-align: left;background: #fff;width: 293px;padding: 10px;color: #080808 !important;opacity: 1 !important;font-weight: 600;font-size: 20px;">
<a style="color: #080808 !important;" href="https://www.cybrosys.com">Cybrosys Technologies</a>
</h5>
</div>
</section>
<section class="oe_container" style="padding: 3% 0% 3% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Overview
</h2>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
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.
</h3>
</div>
</section>
<section class="oe_container" style="background-image:url(https://www.cybrosys.com/images/odoo-index-banner.png); background-repeat:no-repeat; background-size:cover;padding: 19% 0% 30% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Features
</h2>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
Create and configure vouchers for providing a discount based on product, product category or for all products.
</h3>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
Generate a unique code for each coupon.
</h3><h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
Limit the usage of coupons by each user.
</h3>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
Provide a validity for the coupons. </h3>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
History of coupons used by each customer. </h3>
</div>
</section>
<section class="oe_container" style="padding: 3% 0% 0% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Enable the voucher option from the website.
</h2>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
When we added some product to our cart, under the 'Customize' menu, we can see the 'Voucher Code' option.
</h3>
<div class="oe_row oe_spaced">
<img src="enable_voucher.png" alt="" style="width: 95%;"/>
</div>
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Apply the coupon by providing the secret code.
</h2>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
After enabling the 'Voucher Code' option, we can enter our coupon code. If that code is valid, 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.
</h3>
<div class="oe_row oe_spaced">
<img src="apply_coupon.png" alt="" style="width: 95%;"/>
</div>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
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.
</h3>
<div class="oe_row oe_spaced">
<img src="unable_to_update.png" alt="" style="width: 95%;"/>
</div>
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Create and configure vouchers.
</h2>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
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. The expiry date indicates the validity of this voucher.
</h3>
<div class="oe_row oe_spaced">
<img src="voucher_product.png" alt="" style="width: 95%;"/>
</div>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
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.
</h3>
<div class="oe_row oe_spaced">
<img src="voucher_category.png" alt="" style="width: 95%;"/>
</div>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
The third option can be used to provide discounts for all the products. </h3>
<div class="oe_row oe_spaced">
<img src="voucher_all.png" alt="" style="width: 95%;"/>
</div>
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Create and configure coupons and codes.
</h2>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
When we create the coupon, a unique, auto-generated and editable code will be there for each coupon. There are mainly
two types of coupons, fixed and percentage. The fixed type is used to deduct a fixed amount from the order. The
percentage type will deduct a certain percentage of amount from the order.
The total number of available coupons
and the number of times one user can use this coupon can be set here. It is also possible to limit this coupon to a single customer,
i.e, only one customer can use this coupon.
</h3>
<div class="oe_row oe_spaced">
<img src="coupon.png" alt="" style="width: 95%;"/>
</div>
</div>
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Coupon History.
</h2>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<i class="fa fa-check" aria-hidden="true" style="color: #cd2d47;font-size: 15px;"></i>
Under the 'Coupon History' menu, we can see the details of coupons used by all the customers. </h3>
<div class="oe_row oe_spaced">
<img src="history.png" alt="" style="width: 95%;"/>
</div>
</section>
<section class="oe_container" style="padding: 1% 0% 0% 3%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Our Service
</h2>
<div style="display:flex;padding-top: 20px;justify-content: space-between;">
<div style="flex-basis: 18%;">
<a href="https://www.cybrosys.com/odoo-customization-and-installation/" target="_blank">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<img src="https://www.cybrosys.com/images/odoo-customization.png" style="width: 100%;border-radius: 100%;"/>
</div>
<h3 class="oe_slogan" style="text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
Odoo <br/>Customization
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href="https://www.cybrosys.com/odoo-erp-implementation/" target="_blank">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<img src="https://www.cybrosys.com/images/odoo-erp-implementation.png" style="width: 100%;border-radius: 100%;"/>
</div>
<h3 class="oe_slogan" style="text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
Odoo <br/>Implementation
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href="https://www.cybrosys.com/odoo-erp-integration/" target="_blank">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<img src="https://www.cybrosys.com/images/odoo-erp-integration.png" style="width: 100%;border-radius: 100%;"/>
</div>
<h3 class="oe_slogan" style="text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
Odoo <br/>Integration
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href="https://www.cybrosys.com/odoo-erp-support/" target="_blank">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<img src="https://www.cybrosys.com/images/odoo-erp-support.png" style="width: 100%;border-radius: 100%;"/>
</div>
<h3 class="oe_slogan" style="text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
Odoo <br/>Support
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href="https://www.cybrosys.com/hire-odoo-developer/" target="_blank">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<img src="https://www.cybrosys.com/images/hire-odoo-developer.png" style="width: 100%;border-radius: 100%;"/>
</div>
<h3 class="oe_slogan" style="text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
Hire <br/>Odoo Developer
</h3>
</a>
</div>
</div>
</div>
</section>
<section class="oe_container" style="padding: 3% 0% 0% 3%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Our Industries
</h2>
<div style="display:flex;justify-content: space-between;flex-wrap:wrap;">
<div style="flex-basis: 32%;padding-top: 20px;">
<a href="https://www.cybrosys.com/odoo/industries/best-trading-erp/" target="_blank">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<img src="https://www.cybrosys.com/images/odoo-index-industry-1.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:600;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
Trading
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Easily procure and sell your products.
</h3>
</div>
</a>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<a href="https://www.cybrosys.com/odoo/industries/manufacturing-erp-software/" target="_blank">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<img src="https://www.cybrosys.com/images/odoo-index-industry-2.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:600;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
Manufacturing
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Plan, track and schedule your operations.
</h3>
</div>
</a>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<a href="https://www.cybrosys.com/odoo/industries/restaurant-management/" target="_blank">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<img src="https://www.cybrosys.com/images/odoo-index-industry-3.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:600;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
Restaurant
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Run your bar or restaurant methodical.
</h3>
</div>
</a>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<a href="https://www.cybrosys.com/odoo/industries/pos/" target="_blank">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<img src="https://www.cybrosys.com/images/odoo-index-industry-4.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:600;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
POS
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Easy configuring and convivial selling.
</h3>
</div>
</a>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<a href="https://www.cybrosys.com/odoo/industries/ecommerce-website/" target="_blank">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<img src="https://www.cybrosys.com/images/odoo-index-industry-5.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:600;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 0px;margin-left: 16px;">
E-commerce & Website
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Mobile friendly, awe-inspiring product pages.
</h3>
</div>
</a>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<a href="https://www.cybrosys.com/odoo/industries/hotel-management-erp/" target="_blank">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<img src="https://www.cybrosys.com/images/odoo-index-industry-6.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:600;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
Hotel Management
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
An all-inclusive hotel management application.
</h3>
</div>
</a>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<a href="https://www.cybrosys.com/odoo/industries/education-erp-software/" target="_blank">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<img src="https://www.cybrosys.com/images/odoo-index-industry-7.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:600;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
Education
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
A Collaborative platform for educational management.
</h3>
</div>
</a>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<a href="https://www.cybrosys.com/odoo/industries/service-management/" target="_blank">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<img src="https://www.cybrosys.com/images/odoo-index-industry-8.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:600;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
Service Management
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Keep track of services and invoice accordingly.
</h3>
</div>
</a>
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-image:url(https://www.cybrosys.com/images/odoo-index-footer-bg.png); background-repeat:no-repeat; background-size:100%;padding: 13% 0% 6% 0%;">
<div class="oe_slogan" style="margin-top:10px !important;margin-bottom: 0px;">
<div>
<a style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 14px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i class="fa fa-envelope"></i> Email us </a>
<a style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 14px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com/contact/"><i class="fa fa-phone"></i> Contact Us </a>
<a style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 14px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com/odoo-customization-and-installation/"><i class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="https://www.cybrosys.com/images/logo.png" style="width: 190px; margin-bottom: 25px;margin-top: 30px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></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;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></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; ;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></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;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></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;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a></td>
</div>
</div>
</section>

BIN
website_coupon/static/description/unable_to_update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
website_coupon/static/description/voucher_all.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
website_coupon/static/description/voucher_category.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
website_coupon/static/description/voucher_product.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
website_coupon/static/src/img/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

46
website_coupon/views/applied_coupons.xml

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="applied_coupons_view" model="ir.ui.view">
<field name="name">applied_coupons_form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='sales_purchases']" position="after">
<page name="coupon_applied" string="Applied Coupons">
<field name="applied_coupon" readonly="1">
<tree>
<field name="partner_id" invisible="1"/>
<field name="coupon"/>
<field name="number"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
<record id="gift_coupon_history_tree" model="ir.ui.view">
<field name="name">Gift Coupon History</field>
<field name="model">partner.coupon</field>
<field name="arch" type="xml">
<tree>
<field name="partner_id" />
<field name="coupon" />
<field name="number" />
</tree>
</field>
</record>
<record id="action_gift_coupon_history" model="ir.actions.act_window">
<field name="name">Gift Coupons History</field>
<field name="res_model">partner.coupon</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_id" ref="gift_coupon_history_tree"/>
<field name="view_mode">tree</field>
</record>
<menuitem name="Coupon History" id="gift_coupon_history" action="action_gift_coupon_history" parent="website_coupon.gift_coupon_main"/>
</data>
</odoo>

126
website_coupon/views/gift_voucher.xml

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="gift_voucher_form" model="ir.ui.view">
<field name="name">Gift Voucher</field>
<field name="model">gift.voucher</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="name" />
<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="max_value" />
<field name="expiry_date" />
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="gift_voucher_tree" model="ir.ui.view">
<field name="name">Gift Voucher</field>
<field name="model">gift.voucher</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
<field name="product_id" />
<field name="min_value" />
<field name="max_value" />
<field name="expiry_date" />
</tree>
</field>
</record>
<record id="gift_coupon_form" model="ir.ui.view">
<field name="name">Gift Coupon</field>
<field name="model">gift.coupon</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<label for="name" string="Name" />
<h1>
<field name="name"/>
</h1>
</div>
<group>
<group>
<field name="code" />
<field name="start_date" />
</group>
<group>
<field name="voucher" />
<field name="end_date" />
</group>
</group>
<group string="Conditions">
<group>
<field name="total_avail" />
</group>
<group>
<field name="partner_id" />
<field name="limit" />
</group>
</group>
<group string="Pricing">
<group>
<field name="voucher_val" />
</group>
<group>
<field name="type" />
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="gift_coupon_tree" model="ir.ui.view">
<field name="name">Gift Coupon</field>
<field name="model">gift.coupon</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
<field name="code" />
<field name="voucher" />
<field name="start_date" />
<field name="end_date" />
<field name="partner_id" />
<field name="total_avail" />
<field name="type" />
</tree>
</field>
</record>
<record id="action_gift_voucher" model="ir.actions.act_window">
<field name="name">Gift Vouchers</field>
<field name="res_model">gift.voucher</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_id" ref="gift_voucher_tree"/>
<field name="view_mode">tree,form</field>
</record>
<record id="action_gift_coupon" model="ir.actions.act_window">
<field name="name">Generate Gift Coupons</field>
<field name="res_model">gift.coupon</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_id" ref="gift_coupon_tree"/>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Gift Voucher" id="gift_voucher" action="action_gift_voucher" parent="sale.menu_sale_config"/>
<menuitem name="Gift Coupons" id="gift_coupon_main" parent="sale.sale_menu_root"
sequence="5" />
<menuitem name="Gift Coupon" id="gift_coupon" action="action_gift_coupon" parent="gift_coupon_main"/>
</data>
</odoo>

52
website_coupon/views/templates.xml

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="voucher_code" inherit_id="website_sale.cart"
active="False" customize_show="True"
name="Voucher Code">
<xpath expr="//div[hasclass('oe_website_sale')]"
position="inside">
<h4>Voucher Code</h4>
<p>
Have a voucher code? Fill this field and apply .
</p>
<t t-if="coupon_not_available">
<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>
<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()" />
<div class="input-group">
<input name="promo_voucher" class="form-control"
type="text" placeholder="code..."
t-att-value="website_sale_order.pricelist_id.code or None" />
<div class="input-group-append">
<a href="#" role="button" class="btn btn-secondary a-submit">Apply</a>
</div>
</div>
</form>
</xpath>
</template>
<template id="cart_lines_extended" inherit_id="website_sale.cart_lines">
<xpath expr="//table[@id='cart_products']/thead/tr/th[1]" position="attributes">
<attribute name="width">100</attribute>
</xpath>
<xpath expr="//table[@id='cart_products']/thead/tr/th[3]" position="attributes">
<attribute name="width">130</attribute>
</xpath>
<xpath expr="//table[@id='cart_products']/thead/tr/th[4]" position="attributes">
<attribute name="width">100</attribute>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save