diff --git a/gatepass_slip/README.rst b/gatepass_slip/README.rst new file mode 100644 index 000000000..0aade0b2e --- /dev/null +++ b/gatepass_slip/README.rst @@ -0,0 +1,36 @@ +Gatepass +======== + +Gatepass tickets for delivery orders. + + +Installation +============ +- www.odoo.com/documentation/12.0/setup/install.html +- Install our custom addon + +License +======= +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(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 + +Author +------ + +Developer: Sayooj AO @ Cybrosys + +Maintainer +---------- + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. + diff --git a/gatepass_slip/__init__.py b/gatepass_slip/__init__.py new file mode 100644 index 000000000..94a9b5bdf --- /dev/null +++ b/gatepass_slip/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################### +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Sayooj A O() +# +# This program is free software: you can modify +# it under the terms of the GNU Lesser General Public License(LGPLv3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### + +from . import models diff --git a/gatepass_slip/__manifest__.py b/gatepass_slip/__manifest__.py new file mode 100644 index 000000000..a85a9d76e --- /dev/null +++ b/gatepass_slip/__manifest__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +################################################################################### +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Sayooj A O() +# +# This program is free software: you can modify +# it under the terms of the GNU Lesser General Public License(LGPLv3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### +{ + 'name': 'Gate Pass', + 'summary': """Generating Gate pass slip in delivery orders""", + 'version': '12.0.1.0.0', + 'description': """Generating Gate pass slip in delivery orders""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'http://www.cybrosys.com', + 'category': 'Inventory', + 'depends': ['base', 'stock'], + 'license': 'LGPL-3', + 'data': [ + 'views/gate_pass_details_views.xml', + 'report/gate_pass_template.xml', + 'report/gate_pass_report.xml', + ], + 'demo': [], + 'images': ['static/description/banner.png'], + 'installable': True, + 'auto_install': False, +} diff --git a/gatepass_slip/doc/RELEASE_NOTES.md b/gatepass_slip/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..d4c7a609d --- /dev/null +++ b/gatepass_slip/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 24.04.2019 +#### Version 12.0.1.0.0 +##### ADD +- Initial commit diff --git a/gatepass_slip/models/__init__.py b/gatepass_slip/models/__init__.py new file mode 100644 index 000000000..57b3fcc33 --- /dev/null +++ b/gatepass_slip/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################### +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Sayooj A O() +# +# This program is free software: you can modify +# it under the terms of the GNU Lesser General Public License(LGPLv3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### + +from . import gate_pass_details diff --git a/gatepass_slip/models/gate_pass_details.py b/gatepass_slip/models/gate_pass_details.py new file mode 100644 index 000000000..69a4f8ff0 --- /dev/null +++ b/gatepass_slip/models/gate_pass_details.py @@ -0,0 +1,12 @@ +from odoo import models, api, fields + + +class GatePass(models.Model): + _inherit = 'stock.picking' + + enable_order_line = fields.Boolean(string='Include Product Details', default=True) + vehicle_no = fields.Char(string='Vehicle Number') + vehicle_driver_name = fields.Char(string='Driver Name') + driver_contact_number = fields.Char(string='Contact No') + corresponding_company = fields.Char(string='Company') + diff --git a/gatepass_slip/report/gate_pass_report.xml b/gatepass_slip/report/gate_pass_report.xml new file mode 100644 index 000000000..037bf4a18 --- /dev/null +++ b/gatepass_slip/report/gate_pass_report.xml @@ -0,0 +1,28 @@ + + + + + Gate Pass + + custom + 150 + 240 + Portrait + 40 + 5 + 5 + 5 + + 40 + 90 + + + + \ No newline at end of file diff --git a/gatepass_slip/report/gate_pass_template.xml b/gatepass_slip/report/gate_pass_template.xml new file mode 100644 index 000000000..e6a5b60fa --- /dev/null +++ b/gatepass_slip/report/gate_pass_template.xml @@ -0,0 +1,119 @@ + + + + + + \ No newline at end of file diff --git a/gatepass_slip/static/description/banner.png b/gatepass_slip/static/description/banner.png new file mode 100644 index 000000000..ddb7f710b Binary files /dev/null and b/gatepass_slip/static/description/banner.png differ diff --git a/gatepass_slip/static/description/gate_pass_details.png b/gatepass_slip/static/description/gate_pass_details.png new file mode 100644 index 000000000..e22dbf252 Binary files /dev/null and b/gatepass_slip/static/description/gate_pass_details.png differ diff --git a/gatepass_slip/static/description/gate_pass_print.png b/gatepass_slip/static/description/gate_pass_print.png new file mode 100644 index 000000000..5dc68b753 Binary files /dev/null and b/gatepass_slip/static/description/gate_pass_print.png differ diff --git a/gatepass_slip/static/description/gate_pass_report.png b/gatepass_slip/static/description/gate_pass_report.png new file mode 100644 index 000000000..8b49d34bd Binary files /dev/null and b/gatepass_slip/static/description/gate_pass_report.png differ diff --git a/gatepass_slip/static/description/icon.png b/gatepass_slip/static/description/icon.png new file mode 100644 index 000000000..bde7e7efb Binary files /dev/null and b/gatepass_slip/static/description/icon.png differ diff --git a/gatepass_slip/static/description/index.html b/gatepass_slip/static/description/index.html new file mode 100644 index 000000000..107b86cc4 --- /dev/null +++ b/gatepass_slip/static/description/index.html @@ -0,0 +1,354 @@ + +
+
+

+ Gatepass +

+

+ Module For generating gatepass tickets for delivery orders +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies +
+
+
+
+ +
+
+

+ Overview +

+

+ Gatepass modules helps to generate gatepass tickets including the details of the vehicle,driver and the information about the + company which the vehicle belongs to with entry date and time.And the information of the products in the delivery order. +

+

+ Configuration +

+

+ No additional configuration required +

+
+
+ +
+
+

+ Features +

+

+ + Creating the details of Gatepass with details of Vehicle number,Driver's name,Contact information of the driver, + company of the driver +

+

+ + Information about the products in the delivery order also provided in the ticket. + This can be enable from the "Gatepass details'" form +

+

+ + Printing Gatepass ticket +

+
+
+ +
+
+

+ Screenshots +

+

+ + Here we can fill the details regarding to the Gate Pass +

+
+ +
+

+ + From the Print menu we can print the Gate Pass Ticket +

+
+ +
+

+ + This would be the printed Gate Pass Ticket +

+
+ +
+
+
+ +
+
+ cybrosys technologies +
+
+
+
+

+ Our Services +

+
+ + + +
+ +
+ + + +
+

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
diff --git a/gatepass_slip/views/gate_pass_details_views.xml b/gatepass_slip/views/gate_pass_details_views.xml new file mode 100644 index 000000000..7c47ac3f3 --- /dev/null +++ b/gatepass_slip/views/gate_pass_details_views.xml @@ -0,0 +1,23 @@ + + + + + gate slip + stock.picking + + + + + + + + + + + + + + + + + diff --git a/sale_promotion/README.rst b/sale_promotion/README.rst new file mode 100644 index 000000000..33d7cdea0 --- /dev/null +++ b/sale_promotion/README.rst @@ -0,0 +1,48 @@ +================== +Sale Promotion v12 +================== +Add option to give promotion for your products. + +Contacts +======== +* Cybrosys Techno Solutions + +Depends +======= +[sale] addon Odoo +[account_invoicing] addon Odoo + +Tech +==== +* [Python] - Models +* [XML] - Odoo views + +Installation +============ +- www.odoo.com/documentation/12.0/setup/install.html +- Install our custom addon + +License +======= + GNU Affero General Public License + (http://www.gnu.org/licenses/agpl.html) + +Bug Tracker +=========== + +Contact odoo@cybrosys.com + +Authors +------- +* Developer v10: Anusha @ Cybrosys +* Developer v11, V12: Niyas Raphy @ Cybrosys + +Maintainer +---------- + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. + + + diff --git a/sale_promotion/__init__.py b/sale_promotion/__init__.py new file mode 100644 index 000000000..3e82b33e0 --- /dev/null +++ b/sale_promotion/__init__.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Anusha P P() +# 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 . +# +############################################################################# + +from . import models + + + diff --git a/sale_promotion/__manifest__.py b/sale_promotion/__manifest__.py new file mode 100644 index 000000000..2f074a884 --- /dev/null +++ b/sale_promotion/__manifest__.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Anusha P P() +# 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 . +# +############################################################################# + +{ + 'name': "Sale Promotion", + 'version': '12.0.1.0.0', + 'summary': """Create Promotion Offers For Sales""", + 'description': """This Module Allows to Set Promotion Offers On Products And Product Categories.""", + 'author': "Cybrosys Techno Solutions", + 'maintainer': 'Cybrosys Techno Solutions', + 'company': "Cybrosys Techno Solutions", + 'website': "https://www.cybrosys.com", + 'category': 'Sales', + 'depends': ['sale', 'account'], + 'data': [ + 'security/ir.model.access.csv', + 'views/promotion_product.xml', + 'views/sale_promotion_rule.xml', + 'views/sale_order.xml', + ], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, +} + + diff --git a/sale_promotion/doc/RELEASE_NOTES.md b/sale_promotion/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..c28935327 --- /dev/null +++ b/sale_promotion/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 24.04.2019 +#### Version 12.0.1.0.0 +##### ADD +- Initial commit diff --git a/sale_promotion/models/__init__.py b/sale_promotion/models/__init__.py new file mode 100644 index 000000000..61dd5df6f --- /dev/null +++ b/sale_promotion/models/__init__.py @@ -0,0 +1,28 @@ +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Anusha P P() +# 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 . +# +############################################################################# + +from . import promotion_product +from . import sale_promotion_rule +from . import sale_order + + + diff --git a/sale_promotion/models/promotion_product.py b/sale_promotion/models/promotion_product.py new file mode 100644 index 000000000..6105c8e9e --- /dev/null +++ b/sale_promotion/models/promotion_product.py @@ -0,0 +1,34 @@ +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Anusha P P() +# 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 . +# +############################################################################# + +from odoo import models, fields + + +class PromotionProduct(models.Model): + _inherit = 'product.template' + + is_promotion_product = fields.Boolean(string="Promotion Product", + default=False, + help='This is a promotion product') + + + diff --git a/sale_promotion/models/sale_order.py b/sale_promotion/models/sale_order.py new file mode 100644 index 000000000..27408298f --- /dev/null +++ b/sale_promotion/models/sale_order.py @@ -0,0 +1,180 @@ +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Cybrosys() +# 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 . +# +############################################################################# + +from dateutil import parser +from odoo import models, fields, api, _ +from odoo.exceptions import UserError + + +class SalePromotion(models.Model): + _inherit = 'sale.order' + + sale_promotion_id = fields.Many2one('sale.promotion', string="Sale Promotion") + + @api.multi + def button_dump_sale_promotion(self): + + for order in self: + if order.sale_promotion_id: + date_order = order.date_order + product_list = [] + category_list = [] + for line in order.order_line: + count = 0 + categ_count = 0 + if line.is_promotion_line: + line.unlink() + else: + if product_list: + for data in product_list: + if data['product_id'] == line.product_id.id: + data['qty'] += line.product_uom_qty + count += 1 + if count == 0: + product_list.append({ + 'product_id': line.product_id.id, + 'qty': line.product_uom_qty, + }) + else: + product_list.append({ + 'product_id': line.product_id.id, + 'qty': line.product_uom_qty, + }) + if category_list: + for prod in category_list: + if prod['category'] == line.product_id.categ_id.id: + prod['qty'] += line.product_uom_qty + categ_count += 1 + + if categ_count == 0: + category_list.append({ + 'qty': line.product_uom_qty, + 'category': line.product_id.categ_id.id, + }) + else: + category_list.append({ + 'qty': line.product_uom_qty, + 'category': line.product_id.categ_id.id, + }) + category_rule_ids = [] + product_rule_ids = [] + for obj in self.sale_promotion_id: + for promo_lines in obj.item_ids: + if not promo_lines.date_start or promo_lines.date_start <= date_order: + if not promo_lines.date_end or promo_lines.date_end >= date_order: + if promo_lines.applied_on == 'product_category': + categ_val = {'rule': promo_lines, + 'category': promo_lines.categ_id.id, + 'qty': promo_lines.min_quantity, + } + category_rule_ids.append(categ_val) + elif promo_lines.applied_on == 'product': + + pr_val = {'rule': promo_lines, + 'product_id': promo_lines.product_tmpl_id.id, + 'qty': promo_lines.min_quantity, + } + product_rule_ids.append(pr_val) + sale_line_obj = self.env['sale.order.line'] + if product_rule_ids and product_list: + for data in product_list: + rules = [] + for i in product_rule_ids: + if i['product_id'] == data['product_id']: + if data['qty'] >= i['rule'].min_quantity: + rules.append(i) + if len(rules) > 1: + max_qty_rule = max(rules, key=lambda x: x['qty']) + for line in max_qty_rule['rule'].promotion_rule_lines: + sale_line_obj.create({ + 'name': line.product_id.name, + 'price_unit': 0, + 'product_uom_qty': line.quantity, + 'order_id': order.id, + 'discount': 0.0, + 'product_uom': line.product_id.uom_id.id, + 'product_id': line.product_id.id, + 'tax_id': [], + 'is_promotion_line': True, + }) + elif len(rules) == 1: + for r in rules: + for line in r['rule'].promotion_rule_lines: + sale_line_obj.create({ + 'name': line.product_id.name, + 'price_unit': 0, + 'product_uom_qty': line.quantity, + 'order_id': order.id, + 'discount': 0.0, + 'product_uom': line.product_id.uom_id.id, + 'product_id': line.product_id.id, + 'tax_id': [], + 'is_promotion_line': True, + }) + else: + pass + + if category_rule_ids and category_list: + for categ in category_list: + rules = [] + for r in category_rule_ids: + if categ['category'] == r['category']: + if categ['qty'] >= r['rule'].min_quantity: + rules.append(r) + if len(rules) > 1: + max_qty_rule = max(rules, key=lambda x: x['qty']) + for line in max_qty_rule['rule'].promotion_rule_lines: + sale_line_obj.create({ + 'name': line.product_id.name, + 'price_unit': 0, + 'product_uom_qty': line.quantity, + 'order_id': order.id, + 'discount': 0.0, + 'product_uom': line.product_id.uom_id.id, + 'product_id': line.product_id.id, + 'tax_id': [], + 'is_promotion_line': True, + }) + elif len(rules) == 1: + for r in rules: + for line in r['rule'].promotion_rule_lines: + sale_line_obj.create({ + 'name': line.product_id.name, + 'price_unit': 0, + 'product_uom_qty': line.quantity, + 'order_id': order.id, + 'discount': 0.0, + 'product_uom': line.product_id.uom_id.id, + 'product_id': line.product_id.id, + 'tax_id': [], + 'is_promotion_line': True, + }) + else: + pass + else: + raise UserError(_('Please Select an Promotion Rule.')) + + +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' + + is_promotion_line = fields.Boolean(string='Promotion Line') diff --git a/sale_promotion/models/sale_promotion_rule.py b/sale_promotion/models/sale_promotion_rule.py new file mode 100644 index 000000000..b4e5f032f --- /dev/null +++ b/sale_promotion/models/sale_promotion_rule.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Anusha P P() +# 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 . +# +############################################################################# + +from odoo.exceptions import UserError +from odoo import models, fields, _, api + + +class SalePromotion(models.Model): + _name = 'sale.promotion' + + def _get_default_currency_id(self): + return self.env.user.company_id.currency_id.id + + name = fields.Char(string="Name", required=True) + item_ids = fields.One2many('sale.promotion.rule', 'promotion_id', string="Promotion Rules") + company_id = fields.Many2one('res.company') + currency_id = fields.Many2one('res.currency') + + +class SalePromotionRule(models.Model): + _name = 'sale.promotion.rule' + + name = fields.Char(string="Name", required=True) + promotion_id = fields.Many2one('sale.promotion', string="Promotion Rule") + applied_on = fields.Selection([('product_category', 'Product Category'), + ('product', 'Product')], string="Applied On", default='product', required=True) + min_quantity = fields.Integer(string="Minimum Quantity") + date_start = fields.Date(string="Date Start") + date_end = fields.Date(string="Date End") + categ_id = fields.Many2one('product.category', string="Product Category") + product_tmpl_id = fields.Many2one('product.product', string="Product") + + company_id = fields.Many2one('res.company', string='Company', readonly=True, related='promotion_id.company_id', store=True) + currency_id = fields.Many2one('res.currency', string='Currency', + readonly=True, related='promotion_id.currency_id', store=True) + promotion_rule_lines = fields.One2many('sale.promotion.rule.line', 'promotion_rule_id', string="Promotion Lines") + + @api.constrains('date_start', 'date_end') + def check_date(self): + if self.date_start and self.date_end: + if self.date_end < self.date_start: + raise UserError(_('Please check the Ending date.')) + + @api.constrains('promotion_rule_lines') + def check_promotion(self): + if not self.promotion_rule_lines: + raise UserError(_('Please Add some promotion products.')) + + +class SalePromotionLines(models.Model): + _name = 'sale.promotion.rule.line' + + product_id = fields.Many2one('product.product', string="Product") + quantity = fields.Integer(string="Quantity") + promotion_rule_id = fields.Many2one('sale.promotion.rule', string="Promotion Lines") + + + + + + diff --git a/sale_promotion/security/ir.model.access.csv b/sale_promotion/security/ir.model.access.csv new file mode 100644 index 000000000..52e7d9e33 --- /dev/null +++ b/sale_promotion/security/ir.model.access.csv @@ -0,0 +1,7 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_sale_promotion_manager,sale.promotion,model_sale_promotion,sales_team.group_sale_manager,1,1,1,1 +access_sale_promotion_salesman,sale.promotion,model_sale_promotion,sales_team.group_sale_salesman,1,1,1,1 +access_sale_promotion_rule_manager,sale.promotion.rule,model_sale_promotion_rule,sales_team.group_sale_manager,1,1,1,1 +access_sale_promotion_rule_salesman,sale.promotion.rule,model_sale_promotion_rule,sales_team.group_sale_salesman,1,1,1,1 +access_sale_promotion_rule_line_manager,sale.promotion.rule.line,model_sale_promotion_rule_line,sales_team.group_sale_manager,1,1,1,1 +access_sale_promotion_rule_line_salesman,sale.promotion.rule.line,model_sale_promotion_rule_line,sales_team.group_sale_salesman,1,1,1,1 \ No newline at end of file diff --git a/sale_promotion/static/description/banner.jpg b/sale_promotion/static/description/banner.jpg new file mode 100644 index 000000000..2625f7727 Binary files /dev/null and b/sale_promotion/static/description/banner.jpg differ diff --git a/sale_promotion/static/description/cybro_logo.png b/sale_promotion/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/sale_promotion/static/description/cybro_logo.png differ diff --git a/sale_promotion/static/description/icon.png b/sale_promotion/static/description/icon.png new file mode 100644 index 000000000..5bb38d990 Binary files /dev/null and b/sale_promotion/static/description/icon.png differ diff --git a/sale_promotion/static/description/index.html b/sale_promotion/static/description/index.html new file mode 100644 index 000000000..ace4927db --- /dev/null +++ b/sale_promotion/static/description/index.html @@ -0,0 +1,310 @@ + +
+
+

+ Sale Promotion +

+

+ Set sales promotion offers on product and product categories. +

+
+ Cybrosys Technologies +
+
+
+
+
+

+ Overview +

+

+ The module, allows the user to set sales promotion offers on products and product category. + Create product and Product category based specific promotion rules and improve the sales. +

+
+
+ +
+
+

+ Features +

+

+ + Create sales promotion offers for products. +

+

+ + Create sales promotion offers for product categories. +

+ + Attract more customers. +

+
+
+
+
+

+ Create Promotion Rules +

+

+ + Case 1.Buy One get One Free. +

+
+ +
+
+ +
+

+ + Case 2.Buy 2 Get Another Free +

+
+ +
+
+ +
+

Select Offer In Sale Order

+

+ + Select the promotion rule in the sale order and click on 'Apply Offer' +

+
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+ + diff --git a/sale_promotion/static/description/sale_promotion.png b/sale_promotion/static/description/sale_promotion.png new file mode 100644 index 000000000..75701cc03 Binary files /dev/null and b/sale_promotion/static/description/sale_promotion.png differ diff --git a/sale_promotion/static/description/sale_promotion_1.png b/sale_promotion/static/description/sale_promotion_1.png new file mode 100644 index 000000000..507a51dd4 Binary files /dev/null and b/sale_promotion/static/description/sale_promotion_1.png differ diff --git a/sale_promotion/static/description/sale_promotion_2.png b/sale_promotion/static/description/sale_promotion_2.png new file mode 100644 index 000000000..8264e288c Binary files /dev/null and b/sale_promotion/static/description/sale_promotion_2.png differ diff --git a/sale_promotion/static/description/sale_promotion_3.png b/sale_promotion/static/description/sale_promotion_3.png new file mode 100644 index 000000000..45b7455ae Binary files /dev/null and b/sale_promotion/static/description/sale_promotion_3.png differ diff --git a/sale_promotion/static/description/sale_promotion_4.png b/sale_promotion/static/description/sale_promotion_4.png new file mode 100644 index 000000000..e9db894c3 Binary files /dev/null and b/sale_promotion/static/description/sale_promotion_4.png differ diff --git a/sale_promotion/views/promotion_product.xml b/sale_promotion/views/promotion_product.xml new file mode 100644 index 000000000..6b5a25802 --- /dev/null +++ b/sale_promotion/views/promotion_product.xml @@ -0,0 +1,18 @@ + + + + + product.template + product.template + + + + + + + + + + + + diff --git a/sale_promotion/views/sale_order.xml b/sale_promotion/views/sale_order.xml new file mode 100644 index 000000000..d83145bf6 --- /dev/null +++ b/sale_promotion/views/sale_order.xml @@ -0,0 +1,23 @@ + + + + + + sale.order.form + sale.order + + + +