diff --git a/commission_plan/README.rst b/commission_plan/README.rst new file mode 100755 index 000000000..a31dd9425 --- /dev/null +++ b/commission_plan/README.rst @@ -0,0 +1,39 @@ +CRM Commission Plan +=================== +* CRM Commission Plan module for Odoo 15. + +Installation +============ + - www.odoo.com/documentation/15.0/setup/install.html + - Install our custom addon + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.odoo.com/documentation/user/15.0/legal/licenses/licenses.html) + +Company +------- +* 'Cybrosys Techno Solutions '__ + +Credits +------- +* 'Cybrosys Techno Solutions '__ + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/commission_plan/__init__.py b/commission_plan/__init__.py new file mode 100644 index 000000000..8909ff398 --- /dev/null +++ b/commission_plan/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models +from . import wizard +from . import controllers diff --git a/commission_plan/__manifest__.py b/commission_plan/__manifest__.py new file mode 100644 index 000000000..d534518b0 --- /dev/null +++ b/commission_plan/__manifest__.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + "name": "Odoo15 CRM Commission Plan", + 'description': """CRM Commission Plan for odoo15, CRM, crm commission, commission plan, crm features""", + 'summary': """CRM Commission Plan for odoo15""", + "category": 'Sales', + "version": '15.0.1.0.0', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + "depends": ['base', 'sale_management', 'crm'], + "data": [ + 'security/ir.model.access.csv', + 'views/commission.xml', + 'wizard/commission_report.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'commission_plan/static/src/js/action_manager.js', + ], + }, + 'images': [ + 'static/description/banner.png', + ], + 'license': 'LGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False, +} diff --git a/commission_plan/controllers/__init__.py b/commission_plan/controllers/__init__.py new file mode 100644 index 000000000..1178cb52e --- /dev/null +++ b/commission_plan/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import main diff --git a/commission_plan/controllers/main.py b/commission_plan/controllers/main.py new file mode 100644 index 000000000..9bfada6d0 --- /dev/null +++ b/commission_plan/controllers/main.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +import json +from odoo import http +from odoo.http import content_disposition, request +from odoo.addons.web.controllers.main import _serialize_exception +from odoo.tools import html_escape + + +class XLSXReportController(http.Controller): + + @http.route('/xlsx_reports', type='http', auth='user', methods=['POST'], csrf=False) + def get_report_xlsx(self, model, options, output_format, report_name, **kw): + uid = request.session.uid + report_obj = request.env[model].with_user(uid) + options = json.loads(options) + token = 'dummy-because-api-expects-one' + try: + if output_format == 'xlsx': + response = request.make_response( + None, + headers=[ + ('Content-Type', 'application/vnd.ms-excel'), + ('Content-Disposition', content_disposition(report_name + '.xlsx')) + ] + ) + report_obj.get_xlsx_report(options, response) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = _serialize_exception(e) + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': se + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/commission_plan/doc/RELEASE_NOTES.md b/commission_plan/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..7aa52d11a --- /dev/null +++ b/commission_plan/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 18.12.2021 +#### Version 15.0.1.0.0 +#### ADD +- Initial commit for Commission Plan Module \ No newline at end of file diff --git a/commission_plan/models/__init__.py b/commission_plan/models/__init__.py new file mode 100644 index 000000000..67d5b1c6f --- /dev/null +++ b/commission_plan/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import commission diff --git a/commission_plan/models/commission.py b/commission_plan/models/commission.py new file mode 100644 index 000000000..53c65ca49 --- /dev/null +++ b/commission_plan/models/commission.py @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import exceptions +from odoo import fields, models, api, _ + + +class CommissionPlan(models.Model): + _name = 'crm.commission' + _description = 'Commission Plan' + _rec_name = "name" + _inherit = ['mail.thread', 'mail.activity.mixin'] + + name = fields.Char('Name', required=True) + active = fields.Boolean('Active', default=True) + date_from = fields.Date(string="From Date", required=True) + date_to = fields.Date(string="To Date", required=True) + type = fields.Selection( + [('product', 'Product wise'), + ('revenue', 'Revenue wise')], string="Type", + default="product") + team_id = fields.Many2one('crm.team', string='Sales Team') + user_id = fields.Many2one('res.users', string='Salesperson') + product_comm_ids = fields.One2many('commission.product', 'commission_id', + string="Product Wise") + straight_commission_rate = fields.Float(string='Commission rate (%)') + revenue_grd_comm_ids = fields.One2many( + 'commission.graduated', + 'commission_id', + string="Revenue Graduated Wise") + + revenue_type = fields.Selection( + [('straight', 'Straight Commission'), + ('graduated', 'Graduated Commission')], + string="Revenue Type") + + @api.constrains("date_from", "date_to") + def _check_date(self): + for rec in self: + if rec.date_to < rec.date_from: + raise exceptions.ValidationError( + _("The From date cannot be earlier than To date.") + ) + + @api.onchange('type') + def onchange_type(self): + if self.type == 'revenue': + self.product_comm_ids = [(5, 0, 0)] + elif self.type == 'product': + self.revenue_type = False + self.straight_commission_rate = False + self.revenue_grd_comm_ids = [(5, 0, 0)] + + +class CommissionProduct(models.Model): + _name = 'commission.product' + _description = 'Commission Product Wise' + + user_id = fields.Many2one('res.users') + category_id = fields.Many2one('product.category', string='Product Category') + product_id = fields.Many2one('product.product', string='Product', + domain="[('categ_id', '=', category_id)]") + percentage = fields.Float(string='Rate in Percentage (%)') + amount = fields.Monetary('Maximum Commission Amount', default=0.0) + currency_id = fields.Many2one("res.currency", string="Currency", + default=lambda self: + self.env.user.company_id.currency_id.id) + commission_id = fields.Many2one("crm.commission") + + +class CommissionRevenueGraduated(models.Model): + _name = 'commission.graduated' + _description = 'Commission Revenue Graduated Wise' + + graduated_commission_rate = fields.Float(string='Commission rate (%)') + amount_from = fields.Float(string="From Amount") + amount_to = fields.Float(string="To Amount") + commission_id = fields.Many2one("crm.commission") + sequence = fields.Integer(string='Sequence', compute='_compute_sequence', + store=True) + + @api.depends('commission_id') + def _compute_sequence(self): + number = 1 + seq = self.mapped('commission_id') + for rule in seq.revenue_grd_comm_ids: + rule.sequence = number + number += 1 + + @api.constrains("amount_from", "amount_to") + def _check_amounts(self): + for rec in self: + if rec.amount_to < rec.amount_from: + raise exceptions.ValidationError( + _("The From Amount limit cannot be greater than To Amount.") + ) + + +class CrmTeam(models.Model): + _inherit = 'crm.team' + + commission_id = fields.Many2one('crm.commission', string='Commission Plan') + + +class CrmSalespersons(models.Model): + _inherit = 'res.users' + + commission_id = fields.Many2one('crm.commission', string='Commission Plan') diff --git a/commission_plan/security/ir.model.access.csv b/commission_plan/security/ir.model.access.csv new file mode 100644 index 000000000..77920af24 --- /dev/null +++ b/commission_plan/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_commission_plan,crm.commission,model_crm_commission,base.group_user,1,1,1,1 +access_commission_product,commission.product,model_commission_product,base.group_user,1,1,1,1 +access_commission_wizard,commission.wizard,model_commission_wizard,base.group_user,1,1,1,1 +access_commission_graduated,commission.graduated,model_commission_graduated,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/commission_plan/static/description/assets/icons/check.png b/commission_plan/static/description/assets/icons/check.png new file mode 100644 index 000000000..ea0da5029 Binary files /dev/null and b/commission_plan/static/description/assets/icons/check.png differ diff --git a/commission_plan/static/description/assets/icons/chevron.png b/commission_plan/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..f49dd8541 Binary files /dev/null and b/commission_plan/static/description/assets/icons/chevron.png differ diff --git a/commission_plan/static/description/assets/icons/cogs.png b/commission_plan/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/commission_plan/static/description/assets/icons/cogs.png differ diff --git a/commission_plan/static/description/assets/icons/consultation.png b/commission_plan/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/commission_plan/static/description/assets/icons/consultation.png differ diff --git a/commission_plan/static/description/assets/icons/ecom-black.png b/commission_plan/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/commission_plan/static/description/assets/icons/ecom-black.png differ diff --git a/commission_plan/static/description/assets/icons/education-black.png b/commission_plan/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/commission_plan/static/description/assets/icons/education-black.png differ diff --git a/commission_plan/static/description/assets/icons/hotel-black.png b/commission_plan/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/commission_plan/static/description/assets/icons/hotel-black.png differ diff --git a/commission_plan/static/description/assets/icons/icon.png b/commission_plan/static/description/assets/icons/icon.png new file mode 100644 index 000000000..61b0eb171 Binary files /dev/null and b/commission_plan/static/description/assets/icons/icon.png differ diff --git a/commission_plan/static/description/assets/icons/license.png b/commission_plan/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/commission_plan/static/description/assets/icons/license.png differ diff --git a/commission_plan/static/description/assets/icons/lifebuoy.png b/commission_plan/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/commission_plan/static/description/assets/icons/lifebuoy.png differ diff --git a/commission_plan/static/description/assets/icons/logo.png b/commission_plan/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/commission_plan/static/description/assets/icons/logo.png differ diff --git a/commission_plan/static/description/assets/icons/manufacturing-black.png b/commission_plan/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/commission_plan/static/description/assets/icons/manufacturing-black.png differ diff --git a/commission_plan/static/description/assets/icons/pos-black.png b/commission_plan/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/commission_plan/static/description/assets/icons/pos-black.png differ diff --git a/commission_plan/static/description/assets/icons/puzzle.png b/commission_plan/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/commission_plan/static/description/assets/icons/puzzle.png differ diff --git a/commission_plan/static/description/assets/icons/restaurant-black.png b/commission_plan/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/commission_plan/static/description/assets/icons/restaurant-black.png differ diff --git a/commission_plan/static/description/assets/icons/service-black.png b/commission_plan/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/commission_plan/static/description/assets/icons/service-black.png differ diff --git a/commission_plan/static/description/assets/icons/trading-black.png b/commission_plan/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/commission_plan/static/description/assets/icons/trading-black.png differ diff --git a/commission_plan/static/description/assets/icons/training.png b/commission_plan/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/commission_plan/static/description/assets/icons/training.png differ diff --git a/commission_plan/static/description/assets/icons/update.png b/commission_plan/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/commission_plan/static/description/assets/icons/update.png differ diff --git a/commission_plan/static/description/assets/icons/user.png b/commission_plan/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/commission_plan/static/description/assets/icons/user.png differ diff --git a/commission_plan/static/description/assets/icons/wrench.png b/commission_plan/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/commission_plan/static/description/assets/icons/wrench.png differ diff --git a/commission_plan/static/description/assets/modules/accounting_image.gif b/commission_plan/static/description/assets/modules/accounting_image.gif new file mode 100644 index 000000000..69bf230e7 Binary files /dev/null and b/commission_plan/static/description/assets/modules/accounting_image.gif differ diff --git a/commission_plan/static/description/assets/modules/approval_image.png b/commission_plan/static/description/assets/modules/approval_image.png new file mode 100644 index 000000000..84fe94e80 Binary files /dev/null and b/commission_plan/static/description/assets/modules/approval_image.png differ diff --git a/commission_plan/static/description/assets/modules/budget_image.png b/commission_plan/static/description/assets/modules/budget_image.png new file mode 100644 index 000000000..fe6aa6fe4 Binary files /dev/null and b/commission_plan/static/description/assets/modules/budget_image.png differ diff --git a/commission_plan/static/description/assets/modules/deadline_image.png b/commission_plan/static/description/assets/modules/deadline_image.png new file mode 100644 index 000000000..6bd27b8b5 Binary files /dev/null and b/commission_plan/static/description/assets/modules/deadline_image.png differ diff --git a/commission_plan/static/description/assets/modules/export_image.png b/commission_plan/static/description/assets/modules/export_image.png new file mode 100644 index 000000000..4e4ea0e51 Binary files /dev/null and b/commission_plan/static/description/assets/modules/export_image.png differ diff --git a/commission_plan/static/description/assets/modules/pos_image.png b/commission_plan/static/description/assets/modules/pos_image.png new file mode 100644 index 000000000..c5932894b Binary files /dev/null and b/commission_plan/static/description/assets/modules/pos_image.png differ diff --git a/commission_plan/static/description/assets/screenshots/CRM-Dashboard-user.png b/commission_plan/static/description/assets/screenshots/CRM-Dashboard-user.png new file mode 100644 index 000000000..794115f30 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/CRM-Dashboard-user.png differ diff --git a/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-1.png b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-1.png new file mode 100644 index 000000000..215a45b39 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-1.png differ diff --git a/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-2.png b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-2.png new file mode 100644 index 000000000..2d24daaf6 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-2.png differ diff --git a/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-3.png b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-3.png new file mode 100644 index 000000000..4de984223 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-3.png differ diff --git a/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-4.png b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-4.png new file mode 100644 index 000000000..76d6b46a6 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-4.png differ diff --git a/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-5.png b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-5.png new file mode 100644 index 000000000..35253c12e Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-5.png differ diff --git a/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-6.png b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-6.png new file mode 100644 index 000000000..b65fb540e Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-6.png differ diff --git a/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-7.png b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-7.png new file mode 100644 index 000000000..20b5e973a Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/Crm-Commission-Plan-7.png differ diff --git a/commission_plan/static/description/assets/screenshots/dash_screenshot-1.png b/commission_plan/static/description/assets/screenshots/dash_screenshot-1.png new file mode 100644 index 000000000..1d13a5425 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/dash_screenshot-1.png differ diff --git a/commission_plan/static/description/assets/screenshots/dash_screenshot-2.png b/commission_plan/static/description/assets/screenshots/dash_screenshot-2.png new file mode 100644 index 000000000..5cf05a3c5 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/dash_screenshot-2.png differ diff --git a/commission_plan/static/description/assets/screenshots/dash_screenshot-22.png b/commission_plan/static/description/assets/screenshots/dash_screenshot-22.png new file mode 100644 index 000000000..ad247eb9d Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/dash_screenshot-22.png differ diff --git a/commission_plan/static/description/assets/screenshots/dash_screenshot-3.png b/commission_plan/static/description/assets/screenshots/dash_screenshot-3.png new file mode 100644 index 000000000..11799ce0a Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/dash_screenshot-3.png differ diff --git a/commission_plan/static/description/assets/screenshots/dash_screenshot-4.png b/commission_plan/static/description/assets/screenshots/dash_screenshot-4.png new file mode 100644 index 000000000..944bdfaf5 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/dash_screenshot-4.png differ diff --git a/commission_plan/static/description/assets/screenshots/dash_screenshot-5.png b/commission_plan/static/description/assets/screenshots/dash_screenshot-5.png new file mode 100644 index 000000000..d157c91e0 Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/dash_screenshot-5.png differ diff --git a/commission_plan/static/description/assets/screenshots/dash_screenshot-6.png b/commission_plan/static/description/assets/screenshots/dash_screenshot-6.png new file mode 100644 index 000000000..65e5c42cf Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/dash_screenshot-6.png differ diff --git a/commission_plan/static/description/assets/screenshots/hero.gif b/commission_plan/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..ab739fbee Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/hero.gif differ diff --git a/commission_plan/static/description/assets/screenshots/hero_kit.gif b/commission_plan/static/description/assets/screenshots/hero_kit.gif new file mode 100644 index 000000000..8286c472c Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/hero_kit.gif differ diff --git a/commission_plan/static/description/assets/screenshots/output.gif b/commission_plan/static/description/assets/screenshots/output.gif new file mode 100644 index 000000000..bae45f11a Binary files /dev/null and b/commission_plan/static/description/assets/screenshots/output.gif differ diff --git a/commission_plan/static/description/banner.png b/commission_plan/static/description/banner.png new file mode 100644 index 000000000..8793336c0 Binary files /dev/null and b/commission_plan/static/description/banner.png differ diff --git a/commission_plan/static/description/icon.png b/commission_plan/static/description/icon.png new file mode 100644 index 000000000..a7e709126 Binary files /dev/null and b/commission_plan/static/description/icon.png differ diff --git a/commission_plan/static/description/index.html b/commission_plan/static/description/index.html new file mode 100644 index 000000000..b49bc3513 --- /dev/null +++ b/commission_plan/static/description/index.html @@ -0,0 +1,698 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+ +
+
+
+
+ +
+
+
+
+ +

+ CRM Commission Plan

+
+ +

+ CRM Commission Plan for odoo15 +

+ +
+
+ +
+
+

+ Explore this module

+ + +
+
+
+ +
+
+

+ Overview

+
+

+ Motivating your sales representatives is one of the key factors for successful sales. The + commission-based + plan helps to motivate your Sales Teams and Salespersons to achieve the goals and earnings. + A Commission Plan module is a monetary incentive for motivating Salespeople to meet their Sales + quota + and the CRM Commission Plan has embraced the functionality. In the CRM Commission Plan, we have 2 types of Commission Plans + which are being defined product-wise and revenue-wise further under revenue-wise we have two types: + the straight commission and graduated commission. The CRM Commission Plan also includes the CRM Dashboard which + helps you to see the Overview of the CRM module. Here, you can view all details related to CRM + modules + such as Leads, Opportunities, Expected, and Total Revenue, also we can see the different reports on + the + various CRM activities.
+ Moreover, the Salesperson and the sales team + are + rewarded based on the business Opportunities they bring into the company with a well-structured plan + which + can be crafted in the beginning. +

+
+
+ +
+
+

+ Features

+
+
+
+
+ +

Craft custom Commission to Salesperson and Sales + Team

+
+ +
+ +

Draft Commissions based on Revenue and respective + Product

+
+
+
+
+ +

Define Commission based on Product Category

+
+
+ +

Informative Commission Plan report

+
+
+
+
+
+ +
+
+

+ Configuration

+
+

+ For creating new commission plans:
+

    +
  1. + Creating new commissions:
    +

    Initially Create a new commission and Choose a name to distinguish + that typ

    +
  2. +
  3. + Select the type of the Commission:
    +

    Product-based: Commissions are calculated as the percentage of + the price based on the selected product in the form.

    +

    Revenue-based: A certain percentage of revenue is given as + Commission to the Salesperson

    +

    + Straight revenue: Commissions are calculated using a fixed + percentage of the revenue sold. You can fill the percentage in the field "Commission + rate".
    +

    +

    + Graduated revenue: Commissions are calculated as a percentage + of the revenue generated at amount intervals.
    +

    +

    + You can fill in the amount intervals and the percentages in the + "Graduated Revenue Commission" field.
    +

    +
  4. +
+ +

+ For adding Commission in Salesperson & Sales team:
+

+ Go to CRM -> Configuration -> Salesperson or Sales team +
    +
  • Edit the Salesperson or Sales team
  • +
  • Choose a commission type
  • +
  • Save it
  • +
+ +

+ For printing Commission in XLSX report::
+

+ Go to CRM -> Configuration -> Salesperson or Sales team +
    +
  • CRM -> Reporting -> Commission Report
  • +
  • CRM -> Reporting -> Commission Report
  • +
+
+
+ + +
+
+

+ Screenshots

+
+
+
+ +

Commission Plan

+
+

The Commission Plan window can be accessed from the Configuration tab of the module and + selected + on + the Commission Plan menu. Here all the Commission Plan details of the operation in respect + to + the + functioning of the Odoo CRM will be depicted.

+ +
+ +
+
+ +

Commission Plan based on Product Category

+
+

The Commission Plan Creation window can be accessed from the Commission Plan window and while + selecting the Type the Product Wise options can be selected. Further, the Product Categories + with + respect to the respective Product Category based Commission Plan can be defined.

+ +
+
+
+ +

Revenue-based Commission Plan: Straight Revenue Commission Plan

+
+

The second form of Commission Plan in the Odoo CRM Commission Plan where the Sales Revenue and its + percentage + calculation will be provided as Commission to the Salesperson.
+ While Creating a Straight Revenue Commission plan the Commission type can be selected as + Straight + Commission. Further, the commission rate can be defined under the Straight Revenue + Commission + tab.

+ +
+ +
+
+ +

Revenue-based Commission Plan: Graduated Revenue Commission Plan

+
+

While Creating a Graduated Revenue Commission Plan the Commission type can be selected as + Graduated Commission. Further, the commission rate can be defined under the Graduated + Revenue + Commission tab.

+ +
+ +
+
+ +

Assigning Commission Plan for Salesperson

+
+

In the CRM Commission Plan under the respective Salesperson description tab, there will be a dedicated + tab + the + Commission Plan where the respective Commission Plan with respect to the operation can be + defined.

+ +
+ +
+
+ +

Assigning Commission Plan for Sales Team

+
+

In the CRM Commission Plan under the respective sales team description tab, there will be a dedicated tab + the + Commission Plan where the respective Commission Plan with respect to the operation can be + defined.

+ +
+ +
+
+ +

Print the Commission Plan Report in XLSX Format

+
+

The CRM Commission Plan also holds an advanced operations feature where the Admins, as well as every + User, + can take the Print out of the Commission Plan Reports based on their need and for the period + of + operations that are required. The Reports can be generated in XLSX formats and can be saved + based + on the need. To take the printout of the Commission Plan Report you should go to the + Reporting + tab + of the CRM Commission Plan and further select the Commission Plan menu and select the Required entries + and + Click to Print XLS.

+ +
+
+
+ + +
+
+

+ Suggested Products

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

+ Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

+ Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

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

+ Need Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/commission_plan/static/src/js/action_manager.js b/commission_plan/static/src/js/action_manager.js new file mode 100644 index 000000000..c61fa821d --- /dev/null +++ b/commission_plan/static/src/js/action_manager.js @@ -0,0 +1,21 @@ +/** @odoo-module */ + +import { registry } from "@web/core/registry"; +import { download } from "@web/core/network/download"; +import framework from 'web.framework'; +import session from 'web.session'; + +registry.category("ir.actions.report handlers").add("xlsx", async (action) => { + if (action.report_type === 'xlsx') { + framework.blockUI(); + var def = $.Deferred(); + session.get_file({ + url: '/xlsx_reports', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: framework.unblockUI, + }); + return def; + } +}); \ No newline at end of file diff --git a/commission_plan/views/commission.xml b/commission_plan/views/commission.xml new file mode 100644 index 000000000..d03d06032 --- /dev/null +++ b/commission_plan/views/commission.xml @@ -0,0 +1,128 @@ + + + + team commission plan + crm.team + + + + + + + + + + sales persons commission plan + res.users + + + + + + + + + + crm.commission.tree + crm.commission + + + + + + + + + + crm.commission.form + crm.commission + +
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + + CRM Commission Plan + ir.actions.act_window + crm.commission + tree,form + +

+ Create New Commission Plan! +

+
+
+ + + + + Sales Persons + ir.actions.act_window + res.users + [('share','=',False)] + tree,kanban,form + + + +
\ No newline at end of file diff --git a/commission_plan/wizard/__init__.py b/commission_plan/wizard/__init__.py new file mode 100644 index 000000000..2653dce1f --- /dev/null +++ b/commission_plan/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import commission_report diff --git a/commission_plan/wizard/commission_report.py b/commission_plan/wizard/commission_report.py new file mode 100644 index 000000000..3f06f8206 --- /dev/null +++ b/commission_plan/wizard/commission_report.py @@ -0,0 +1,370 @@ +"""Report Wizard for Commission Plan""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import io +import json +from odoo import models, fields, api +from odoo.tools import date_utils +from odoo.exceptions import ValidationError + +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + + +class CommissionReportWizard(models.TransientModel): + _name = 'commission.wizard' + _description = 'Commission Report Wizard' + + date_from = fields.Date(string="From Date") + date_to = fields.Date(string="To Date") + salesperson_ids = fields.Many2many('res.users', string='Salesperson', + domain="[('share','=',False)]") + sales_team_ids = fields.Many2many('crm.team', string='Sales Team') + date = fields.Date(string='Date', default=fields.Date.context_today) + is_sales_person = fields.Boolean(default=False, string="Is sales person") + is_sales_team = fields.Boolean(default=False, string="Is sales team") + + @api.onchange('salesperson_ids') + def onchange_salesperson_ids(self): + """Function for hide a field base on values""" + self.is_sales_person = True if self.salesperson_ids else False + + @api.onchange('sales_team_ids') + def onchange_sales_team_ids(self): + self.is_sales_team = True if self.sales_team_ids else False + + @api.constrains('sales_team_ids', 'salesperson_ids') + def sales_team_constrains(self): + """Function for showing validation error""" + for rec in self: + if self.sales_team_ids: + if not rec.sales_team_ids.member_ids: + raise ValidationError( + "Selected Sales Team haven't any Salespersons") + if not self.sales_team_ids.member_ids.commission_id and \ + not self.sales_team_ids.commission_id: + raise ValidationError( + "Selected Sales Team haven't any Commission Plan") + elif self.salesperson_ids and not rec.salesperson_ids.commission_id: + raise ValidationError( + "Selected Salesperson haven't any Commission Plan") + + def print_xls_report(self): + """Function for printing xlsx report""" + # sales person's condition starts here # + user_sale_orders = self.env['sale.order'].search([ + ('user_id', 'in', self.salesperson_ids.ids)]) + user_sale_orders_dict = {} + total_list = [] + commission_list = [] + user_commission_name = [] + user_commission_salesperson = [] + user_obj = user_sale_orders.mapped('user_id').sorted(key=lambda d: d.id) + for user in user_obj: + user_sale_orders_dict.update({ + user: user_sale_orders.filtered(lambda l: l.user_id == user) + }) + for user, user_sale_orders in user_sale_orders_dict.items(): + commission_id = user.commission_id + if not commission_id: + continue + filtered_order_lines = user_sale_orders.filtered( + lambda l: self.date_from <= l.date_order.date( + ) <= self.date_to and l.date_order.date() >= commission_id.date_from + ).mapped('order_line') + filtered_order_lines_commission_total = sum( + filtered_order_lines.mapped('price_subtotal')) + + if commission_id.type == 'product': + commission_products = commission_id.product_comm_ids.product_id + prod_commission = filtered_order_lines.filtered( + lambda l: l.product_id in commission_products) + for rule in commission_id.product_comm_ids.filtered( + lambda l: l.product_id in prod_commission.mapped( + 'product_id')): + product_order_line = prod_commission.filtered( + lambda l: l.product_id == rule.product_id) + total_price = sum( + product_order_line.mapped('price_subtotal')) + product_commission = (total_price * rule.percentage) / 100 + total_list.append(total_price) + user_commission_name.append(commission_id.name) + user_commission_salesperson.append(user.name) + commission_list.append(rule.amount) if ( + product_commission > rule.amount) \ + else commission_list.append(product_commission) + + if commission_id.type == 'revenue' and ( + commission_id.revenue_type == 'graduated'): + for rule in commission_id.revenue_grd_comm_ids: + if rule.amount_from <= filtered_order_lines_commission_total < rule.amount_to: + graduated_commission = (filtered_order_lines_commission_total + * rule.graduated_commission_rate) / 100 + commission_list.append(graduated_commission) + user_commission_name.append(commission_id.name) + user_commission_salesperson.append(user.name) + total_list.append(filtered_order_lines_commission_total) + + if commission_id.type == 'revenue' and ( + commission_id.revenue_type == 'straight'): + straight_commission = (filtered_order_lines_commission_total + * commission_id.straight_commission_rate) / 100 + commission_list.append(straight_commission) + user_commission_name.append(commission_id.name) + user_commission_salesperson.append(user.name) + total_list.append(filtered_order_lines_commission_total) + # sales person's condition ends here # + + if not self.sales_team_ids and not self.salesperson_ids: + self.sales_team_ids = self.env['crm.team'].search([]) + + # sales team's condition starts here # + team_wizard_persons = self.sales_team_ids.member_ids + team_sale_orders = self.env['sale.order'].search( + [('user_id', 'in', team_wizard_persons.ids)]) + team_sale_orders_dict = {} + commission_total = [] + commission = [] + commission_name = [] + commission_salesperson = [] + commission_sales_team = [] + team_obj = team_sale_orders.mapped('user_id').sorted(key=lambda d: d.id) + + for team_user in team_obj: + team_sale_orders_dict.update({ + team_user: team_sale_orders.filtered( + lambda l: l.user_id == team_user) + }) + for team_user, team_sale_orders in team_sale_orders_dict.items(): + commissions_id = team_user.commission_id if team_user.commission_id \ + else team_user.sale_team_id.commission_id + if commissions_id: + filtered_order_lines = team_sale_orders.filtered( + lambda l: self.date_from <= l.date_order.date( + ) <= self.date_to and l.date_order.date() >= commissions_id.date_from + ).mapped('order_line') + filtered_order_lines_commission_total = sum( + filtered_order_lines.mapped('price_subtotal')) + if commissions_id.type == 'product': + commission_products = commissions_id.product_comm_ids.product_id + prod_commission = filtered_order_lines.filtered( + lambda l: l.product_id in commission_products) + for rules in commissions_id.product_comm_ids.filtered( + lambda l: l.product_id in prod_commission.mapped( + 'product_id')): + product_order_line = prod_commission.filtered( + lambda l: l.product_id == rules.product_id) + total_price = sum( + product_order_line.mapped('price_subtotal')) + product_commission = (total_price * rules.percentage) / 100 + commission_total.append(total_price) + commission_name.append(commissions_id.name) + commission_salesperson.append(team_user.name) + commission_sales_team.append( + team_user.sale_team_id.name) + commission.append(rules.amount) if ( + product_commission > rules.amount) \ + else commission.append(product_commission) + + if commissions_id.type == 'revenue' and ( + commissions_id.revenue_type == 'graduated'): + for rules in commissions_id.revenue_grd_comm_ids: + if rules.amount_from <= filtered_order_lines_commission_total \ + < rules.amount_to: + graduated_commission = (filtered_order_lines_commission_total + * rules.graduated_commission_rate) / 100 + commission.append(graduated_commission) + commission_name.append(commissions_id.name) + commission_salesperson.append(team_user.name) + commission_sales_team.append( + team_user.sale_team_id.name) + commission_total.append( + filtered_order_lines_commission_total) + + if commissions_id.type == 'revenue' and ( + commissions_id.revenue_type == 'straight'): + straight_commission = (filtered_order_lines_commission_total + * commissions_id.straight_commission_rate) / 100 + commission.append(straight_commission) + commission_name.append(commissions_id.name) + commission_salesperson.append(team_user.name) + commission_sales_team.append(team_user.sale_team_id.name) + commission_total.append( + filtered_order_lines_commission_total) + # sales team's condition ends here # + + data = { + 'model_id': self.id, + 'date': self.date, + 'date_from': self.date_from, + 'date_to': self.date_to, + 'sales_team_ids': self.sales_team_ids.ids, + 'salesperson_ids': self.salesperson_ids.ids, + 'commission_list': commission_list, + 'total_list': total_list, + 'commission': commission, + 'commission_total': commission_total, + 'commission_name': commission_name, + 'commission_salesperson': commission_salesperson, + 'commission_sales_team': commission_sales_team, + 'user_commission_name': user_commission_name, + 'user_commission_salesperson': user_commission_salesperson, + } + + return { + 'type': 'ir.actions.report', + 'data': { + 'model': 'commission.wizard', + 'options': json.dumps(data, default=date_utils.json_default), + 'output_format': 'xlsx', + 'report_name': 'Commission Plan xlsx report'}, + 'report_type': 'xlsx' + } + + def get_xlsx_report(self, data, response): + """get_xlsx_report function""" + date = data['date'] + team = data['sales_team_ids'] + user = data['salesperson_ids'] + commission_list = data['commission_list'] + total_list = data['total_list'] + commission = data['commission'] + commission_total = data['commission_total'] + commission_name = data['commission_name'] + commission_salesperson = data['commission_salesperson'] + commission_sales_team = data['commission_sales_team'] + user_commission_name = data['user_commission_name'] + user_commission_salesperson = data['user_commission_salesperson'] + + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + head = workbook.add_format({'align': 'center', 'bold': True, + 'font_size': '15px', 'valign': 'vcenter'}) + format1 = workbook.add_format({'align': 'left', 'font_size': '12px'}) + format2 = workbook.add_format({'align': 'right', 'font_size': '12x'}) + format3 = workbook.add_format( + {'align': 'right', 'font_size': '12x', 'bold': True}) + heading = workbook.add_format({'align': 'left', 'bold': True, + 'font_size': '12px', + 'valign': 'vcenter'}) + date_format = workbook.add_format( + {'num_format': 'dd/mm/yy', 'align': 'left', 'font_size': '10px'}) + + sheet.merge_range('A2:B2', "Printed Date: " + date, date_format) + sheet.write('A4', 'No.', heading) + sheet.set_column(5, 1, 25) + sheet.set_row(0, 25) + row = 5 + col = 0 + index = 1 + if user: + sheet.merge_range('A1:E1', 'COMMISSION PLAN REPORT', head) + sheet.write('D2', 'Date From: ' + data['date_from'], date_format) + sheet.write('E2', 'Date To: ' + data['date_to'], date_format) + + sheet.write('B4', 'Sale Persons', heading) + sheet.write('C4', 'Commission Plan Name', heading) + sheet.write('D4', 'Total Revenue', heading) + sheet.write('E4', 'Commission Amount', heading) + + for j in user_commission_salesperson: + sheet.write(row, col + 0, index, format2) + sheet.write(row, col + 1, j, format1) + row += 1 + index += 1 + + row = 5 + col = 0 + for j in user_commission_name: + sheet.write(row, col + 2, j, format1) + row += 1 + + row = 5 + col = 0 + for j in total_list: + sheet.write(row, col + 3, round(j, 2), format2) + row += 1 + + row = 5 + col = 0 + for i in commission_list: + sheet.write(row, col + 4, round(i, 2), format2) + row += 1 + + sheet.write(row + 1, col + 2, 'Total', format3) + sheet.write(row + 1, col + 3, round(sum(total_list), 2), format2) + sheet.write(row + 1, col + 4, round(sum(commission_list), 2), + format2) + + elif team: + sheet.merge_range('A1:F1', 'COMMISSION PLAN REPORT', head) + sheet.write('E2', 'Date From: ' + data['date_from'], date_format) + sheet.write('F2', 'Date To: ' + data['date_to'], date_format) + + sheet.write('B4', 'Sales Teams', heading) + sheet.write('C4', 'Sales Person', heading) + sheet.write('D4', 'Commission Plan Name', heading) + sheet.write('E4', 'Total Revenue', heading) + sheet.write('F4', 'Commission Amount', heading) + + for j in commission_sales_team: + sheet.write(row, col + 0, index, format2) + sheet.write(row, col + 1, j, format1) + row += 1 + index += 1 + + row = 5 + col = 0 + for j in commission_salesperson: + sheet.write(row, col + 2, j, format1) + row += 1 + + row = 5 + col = 0 + for j in commission_name: + sheet.write(row, col + 3, j, format1) + row += 1 + + row = 5 + col = 0 + for j in commission_total: + sheet.write(row, col + 4, round(j, 2), format2) + row += 1 + + row = 5 + col = 0 + for i in commission: + sheet.write(row, col + 5, round(i, 2), format2) + row += 1 + + sheet.write(row + 1, col + 3, 'Total:', format3) + sheet.write(row + 1, col + 4, round(sum(commission_total), 2), + format2) + sheet.write(row + 1, col + 5, round(sum(commission), 2), format2) + + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/commission_plan/wizard/commission_report.xml b/commission_plan/wizard/commission_report.xml new file mode 100644 index 000000000..6a6616588 --- /dev/null +++ b/commission_plan/wizard/commission_report.xml @@ -0,0 +1,48 @@ + + + + commission.wizard.form + commission.wizard + form + +
+ + + + + + + + + + + + + + +
+
+
+
+
+ + + Commission Report + commission.wizard + form + + new + + + +
\ No newline at end of file