Browse Source

Jan 9 [ADD] : Initial Commit 'commission_plan'

pull/299/head
AjmalCybro 1 year ago
parent
commit
9459b53bac
  1. 46
      commission_plan/README.rst
  2. 24
      commission_plan/__init__.py
  3. 51
      commission_plan/__manifest__.py
  4. 22
      commission_plan/controllers/__init__.py
  5. 57
      commission_plan/controllers/commission_plan.py
  6. 6
      commission_plan/doc/RELEASE_NOTES.md
  7. 26
      commission_plan/models/__init__.py
  8. 66
      commission_plan/models/commission_graduated.py
  9. 70
      commission_plan/models/commission_product.py
  10. 93
      commission_plan/models/crm_commission.py
  11. 30
      commission_plan/models/crm_team.py
  12. 30
      commission_plan/models/res_users.py
  13. 5
      commission_plan/security/ir.model.access.csv
  14. BIN
      commission_plan/static/description/assets/icons/check.png
  15. BIN
      commission_plan/static/description/assets/icons/chevron.png
  16. BIN
      commission_plan/static/description/assets/icons/cogs.png
  17. BIN
      commission_plan/static/description/assets/icons/consultation.png
  18. BIN
      commission_plan/static/description/assets/icons/ecom-black.png
  19. BIN
      commission_plan/static/description/assets/icons/education-black.png
  20. BIN
      commission_plan/static/description/assets/icons/hotel-black.png
  21. BIN
      commission_plan/static/description/assets/icons/icon.png
  22. BIN
      commission_plan/static/description/assets/icons/license.png
  23. BIN
      commission_plan/static/description/assets/icons/lifebuoy.png
  24. BIN
      commission_plan/static/description/assets/icons/logo.png
  25. BIN
      commission_plan/static/description/assets/icons/manufacturing-black.png
  26. BIN
      commission_plan/static/description/assets/icons/pos-black.png
  27. BIN
      commission_plan/static/description/assets/icons/puzzle.png
  28. BIN
      commission_plan/static/description/assets/icons/restaurant-black.png
  29. BIN
      commission_plan/static/description/assets/icons/service-black.png
  30. BIN
      commission_plan/static/description/assets/icons/trading-black.png
  31. BIN
      commission_plan/static/description/assets/icons/training.png
  32. BIN
      commission_plan/static/description/assets/icons/update.png
  33. BIN
      commission_plan/static/description/assets/icons/user.png
  34. BIN
      commission_plan/static/description/assets/icons/wrench.png
  35. BIN
      commission_plan/static/description/assets/misc/categories.png
  36. BIN
      commission_plan/static/description/assets/misc/check-box.png
  37. BIN
      commission_plan/static/description/assets/misc/compass.png
  38. BIN
      commission_plan/static/description/assets/misc/config.png
  39. BIN
      commission_plan/static/description/assets/misc/corporate.png
  40. BIN
      commission_plan/static/description/assets/misc/customer-support.png
  41. BIN
      commission_plan/static/description/assets/misc/cybrosys-logo.png
  42. BIN
      commission_plan/static/description/assets/misc/features.png
  43. BIN
      commission_plan/static/description/assets/misc/logo.png
  44. BIN
      commission_plan/static/description/assets/misc/pictures.png
  45. BIN
      commission_plan/static/description/assets/misc/pie-chart.png
  46. BIN
      commission_plan/static/description/assets/misc/right-arrow.png
  47. BIN
      commission_plan/static/description/assets/misc/star.png
  48. BIN
      commission_plan/static/description/assets/misc/support.png
  49. BIN
      commission_plan/static/description/assets/misc/whatsapp.png
  50. BIN
      commission_plan/static/description/assets/modules/budget_image.png
  51. BIN
      commission_plan/static/description/assets/modules/deadline_image.png
  52. BIN
      commission_plan/static/description/assets/modules/dynamic_financial.png
  53. BIN
      commission_plan/static/description/assets/modules/export_image.png
  54. BIN
      commission_plan/static/description/assets/modules/gantt_image.png
  55. BIN
      commission_plan/static/description/assets/modules/pos_image.png
  56. BIN
      commission_plan/static/description/assets/screenshots/1.png
  57. BIN
      commission_plan/static/description/assets/screenshots/2.png
  58. BIN
      commission_plan/static/description/assets/screenshots/3.png
  59. BIN
      commission_plan/static/description/assets/screenshots/4.png
  60. BIN
      commission_plan/static/description/assets/screenshots/5.png
  61. BIN
      commission_plan/static/description/assets/screenshots/6.png
  62. BIN
      commission_plan/static/description/assets/screenshots/7.png
  63. BIN
      commission_plan/static/description/assets/screenshots/8.png
  64. BIN
      commission_plan/static/description/assets/screenshots/CRM-Dashboard-user.png
  65. BIN
      commission_plan/static/description/assets/screenshots/dash_screenshot-1.png
  66. BIN
      commission_plan/static/description/assets/screenshots/dash_screenshot-2.png
  67. BIN
      commission_plan/static/description/assets/screenshots/dash_screenshot-22.png
  68. BIN
      commission_plan/static/description/assets/screenshots/dash_screenshot-3.png
  69. BIN
      commission_plan/static/description/assets/screenshots/dash_screenshot-4.png
  70. BIN
      commission_plan/static/description/assets/screenshots/dash_screenshot-5.png
  71. BIN
      commission_plan/static/description/assets/screenshots/dash_screenshot-6.png
  72. BIN
      commission_plan/static/description/assets/screenshots/hero.gif
  73. BIN
      commission_plan/static/description/assets/screenshots/hero_kit.gif
  74. BIN
      commission_plan/static/description/assets/screenshots/output.gif
  75. BIN
      commission_plan/static/description/banner.png
  76. BIN
      commission_plan/static/description/icon.png
  77. 755
      commission_plan/static/description/index.html
  78. 21
      commission_plan/static/src/js/action_manager.js
  79. 123
      commission_plan/views/crm_commission_views.xml
  80. 14
      commission_plan/views/crm_team_views.xml
  81. 26
      commission_plan/views/res_users_views.xml
  82. 22
      commission_plan/wizard/__init__.py
  83. 476
      commission_plan/wizard/commission_report.py
  84. 47
      commission_plan/wizard/commission_wizard_views.xml

46
commission_plan/README.rst

@ -0,0 +1,46 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
:target: https://www.gnu.org/licenses/lgpl-3.0.en.html
:alt: License: LGPL-3
Odoo CRM Commission Plan
========================
* Additionally, Odoo CRM may include a Commission Plan feature that helps organizations set up and manage commission structures for their sales teams based on predefined rules and criteria.
Configuration
-------------
- www.odoo.com/documentation/16.0/setup/install.html
- Install our custom addon
License
-------
Lesser General Public License, Version 3 (LGPL v3).
(https://www.gnu.org/licenses/lgpl-3.0.en.html)
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits
-------
Developer : (V16) Abhin K, Contact: odoo@cybrosys.com
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
----------
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com
This module is maintained by Cybrosys Technologies.
For support and more information, please visit `Our Website <https://cybrosys.com/>`__
Further information
-------------------
HTML Description: `<static/description/index.html>`__

24
commission_plan/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import controllers
from . import models
from . import wizard

51
commission_plan/__manifest__.py

@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
{
"name": "Odoo CRM Commission Plan",
"version": '16.0.1.0.0',
"category": 'Sales',
'summary': """CRM Commission Plan for odoo16""",
'description': """Odoo 16's CRM module features professional commission
plans that drive sales performance effectively.""",
'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/crm_commission_views.xml',
'views/crm_team_views.xml',
'views/res_users_views.xml',
'wizard/commission_wizard_views.xml',
],
'assets': {
'web.assets_backend': [
'commission_plan/static/src/js/action_manager.js',
],
},
'images': ['static/description/banner.png'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

22
commission_plan/controllers/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import commission_plan

57
commission_plan/controllers/commission_plan.py

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
import json
from odoo import http
from odoo.http import content_disposition, request
from odoo.tools import html_escape
class XLSXReportController(http.Controller):
"""Xlsx report function is defined here"""
@http.route('/xlsx_reports', type='http', auth='user', methods=['POST'], csrf=False)
def get_report_xlsx(self, model, options, output_format, report_name, **kw):
"""Function is called to print xlsx report"""
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 error:
serialize_exception = http.serialize_exception(error)
error = {
'code': 200,
'message': 'Odoo Server Error',
'data': serialize_exception
}
return request.make_response(html_escape(json.dumps(error)))

6
commission_plan/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <commission_plan>
#### 07.11.2023
#### Version 16.0.1.0.0
#### ADD
- Initial commit for Odoo CRM Commission Plan

26
commission_plan/models/__init__.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import commission_graduated
from . import commission_product
from . import crm_commission
from . import crm_team
from . import res_users

66
commission_plan/models/commission_graduated.py

@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, exceptions, fields, models, _
class CommissionGraduated(models.Model):
"""commission.graduated model is defined here"""
_name = 'commission.graduated'
_description = 'Commission Revenue Graduated Wise'
currency_id = fields.Many2one("res.currency", string="Currency",
default=lambda self:
self.env.user.company_id.currency_id.id,
help='Currency of the company')
graduated_amount_type = fields.Selection(
[('percentage', 'Percentage'), ('fixed', 'Fixed Amount')],
string="Amount Type", default='percentage',
help='Graduated Amount Type')
graduated_fixed_amount = fields.Monetary('Commission Amount', default=0.0,
help='Graduated Fixed Amount')
graduated_commission_rate = fields.Float(string='Commission rate (%)',
help='Graduated Commission Rate')
amount_from = fields.Float(string="From Amount", help='The Minimum Amount')
amount_to = fields.Float(string="To Amount", help='The Maximum Amount')
commission_id = fields.Many2one("crm.commission", string='Commission',
help='Crm Commission')
sequence = fields.Integer(string='Sequence', compute='_compute_sequence',
store=True, help='Sequence Generator')
@api.depends('commission_id')
def _compute_sequence(self):
"""sequence is computed in the one2many table"""
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):
"""Amount constraints to check the
amount to is greater than amount from"""
for rec in self:
if rec.amount_to < rec.amount_from:
raise exceptions.ValidationError(
_("The From Amount limit cannot "
"be greater than To Amount."))

70
commission_plan/models/commission_product.py

@ -0,0 +1,70 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models
class CommissionProduct(models.Model):
"""commission.product model is defined here"""
_name = 'commission.product'
_description = 'Commission Product Wise'
user_id = fields.Many2one('res.users', string='User',
help='Select the User')
category_id = fields.Many2one('product.category',
string='Product Category',
help='Select the Product Category')
category_ids = fields.Many2many('product.category',
string='Product Category Reference',
help="To set the domain for the "
"category_id",
compute="_onchange_category_id")
product_id = fields.Many2one('product.product', string='Product',
help='Select the product')
commission_amount_type = fields.Selection([('percentage', 'Percentage'),
('fixed', 'Fixed Amount')],
string="Amount Type",
default='percentage',
help='Commission amount type')
fixed_amount = fields.Monetary('Commission Amount', default=0.0,
help='Fixed Commission Amount')
percentage = fields.Float(string='Rate in Percentage (%)',
help='Rate in percentage')
amount = fields.Monetary('Maximum Commission Amount', default=0.0,
help='Maximum Commission Amount')
currency_id = fields.Many2one("res.currency", string="Currency",
default=lambda self:
self.env.user.company_id.currency_id.id,
help='Currency of the company')
commission_id = fields.Many2one("crm.commission", string='Commission',
help='Select The Crm Commission')
@api.depends('category_id')
def _onchange_category_id(self):
"""Function Sets the domain for selected category and removes
the product if the product is not in the selected category"""
for rec in self:
rec.category_ids = rec.category_id.search(
[('id', 'child_of', rec.category_id.ids)]).ids
rec.product_id = None if rec.product_id.id not in self.env[
'product.product'].search(
[('categ_id', 'in',
rec.category_ids.ids)]).ids else rec.product_id.id

93
commission_plan/models/crm_commission.py

@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, Command, exceptions, fields, models, _
class CommissionPlan(models.Model):
"""crm.commission plan model is defined here"""
_name = 'crm.commission'
_description = 'Commission Plan'
_inherit = ['mail.thread', 'mail.activity.mixin']
name = fields.Char('Name', required=True, help='Name of the Commission')
active = fields.Boolean('Active', default=True, help='Active or not')
date_from = fields.Date(string="From Date", required=True,
help='Start date of the commission plan')
date_to = fields.Date(string="To Date", required=True,
help='End date of the commission plan')
type = fields.Selection(
[('product', 'Product wise'),
('revenue', 'Revenue wise')], string="Type",
default="product", help='Type of the Plan')
team_id = fields.Many2one('crm.team', string='Sales Team',
help='Select the Sales team')
user_id = fields.Many2one('res.users', string='Salesperson',
help='Select the Sales Person')
product_comm_ids = fields.One2many('commission.product', 'commission_id',
string="Product Wise",
help='Relational field of commission'
' product')
currency_id = fields.Many2one("res.currency", string="Currency",
default=lambda self:
self.env.user.company_id.currency_id.id,
help='Currency of the company')
straight_commission_type = fields.Selection([('percentage', 'Percentage'),
('fixed', 'Fixed Amount')],
string="Amount Type",
default='percentage',
help='Straight commission Type')
straight_commission_fixed = fields.Monetary('Commission Amount',
default=0.0,
help='Straight commission'
' fixed amount')
straight_commission_rate = fields.Float(string='Commission rate (%)',
help='Straight Commission Rate')
revenue_grd_comm_ids = fields.One2many(
'commission.graduated',
'commission_id',
string="Revenue Graduated Wise",
help='Relational Commission Graduated')
revenue_type = fields.Selection(
[('straight', 'Straight Commission'),
('graduated', 'Graduated Commission')],
string="Revenue Type",
help='Select the Revenue Type')
@api.constrains("date_from", "date_to")
def _check_date(self):
"""Date constraints"""
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):
"""onchange type the corresponding table
is shown and the other table set to hide"""
if self.type == 'revenue':
self.product_comm_ids = [Command.clear()]
elif self.type == 'product':
self.revenue_type = False
self.straight_commission_rate = False
self.revenue_grd_comm_ids = [Command.clear()]

30
commission_plan/models/crm_team.py

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
class CrmTeam(models.Model):
"""model crm.team is inherited to add commission plan"""
_inherit = 'crm.team'
commission_id = fields.Many2one('crm.commission', string='Commission Plan',
help='Select the Commission Plan')

30
commission_plan/models/res_users.py

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
class ResUsers(models.Model):
"""res.users is inherited to add commission plan"""
_inherit = 'res.users'
commission_id = fields.Many2one('crm.commission', string='Commission Plan',
help='Select the Commission Plan')

5
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,access.crm.commission,model_crm_commission,base.group_user,1,1,1,1
access_commission_product,access.commission.product,model_commission_product,base.group_user,1,1,1,1
access_commission_wizard,access.commission.wizard,model_commission_wizard,base.group_user,1,1,1,1
access_commission_graduated,access.commission.graduated,model_commission_graduated,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_commission_plan access.crm.commission model_crm_commission base.group_user 1 1 1 1
3 access_commission_product access.commission.product model_commission_product base.group_user 1 1 1 1
4 access_commission_wizard access.commission.wizard model_commission_wizard base.group_user 1 1 1 1
5 access_commission_graduated access.commission.graduated model_commission_graduated base.group_user 1 1 1 1

BIN
commission_plan/static/description/assets/icons/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
commission_plan/static/description/assets/icons/chevron.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
commission_plan/static/description/assets/icons/cogs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
commission_plan/static/description/assets/icons/consultation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
commission_plan/static/description/assets/icons/ecom-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
commission_plan/static/description/assets/icons/education-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
commission_plan/static/description/assets/icons/hotel-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
commission_plan/static/description/assets/icons/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
commission_plan/static/description/assets/icons/license.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
commission_plan/static/description/assets/icons/lifebuoy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
commission_plan/static/description/assets/icons/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
commission_plan/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
commission_plan/static/description/assets/icons/pos-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

BIN
commission_plan/static/description/assets/icons/puzzle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

BIN
commission_plan/static/description/assets/icons/restaurant-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
commission_plan/static/description/assets/icons/service-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
commission_plan/static/description/assets/icons/trading-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
commission_plan/static/description/assets/icons/training.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
commission_plan/static/description/assets/icons/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
commission_plan/static/description/assets/icons/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
commission_plan/static/description/assets/icons/wrench.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
commission_plan/static/description/assets/misc/categories.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
commission_plan/static/description/assets/misc/check-box.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
commission_plan/static/description/assets/misc/compass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
commission_plan/static/description/assets/misc/config.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
commission_plan/static/description/assets/misc/corporate.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
commission_plan/static/description/assets/misc/customer-support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
commission_plan/static/description/assets/misc/cybrosys-logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
commission_plan/static/description/assets/misc/features.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

BIN
commission_plan/static/description/assets/misc/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
commission_plan/static/description/assets/misc/pictures.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
commission_plan/static/description/assets/misc/pie-chart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
commission_plan/static/description/assets/misc/right-arrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

BIN
commission_plan/static/description/assets/misc/star.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
commission_plan/static/description/assets/misc/support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
commission_plan/static/description/assets/misc/whatsapp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
commission_plan/static/description/assets/modules/budget_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

BIN
commission_plan/static/description/assets/modules/deadline_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
commission_plan/static/description/assets/modules/dynamic_financial.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

BIN
commission_plan/static/description/assets/modules/export_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
commission_plan/static/description/assets/modules/gantt_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
commission_plan/static/description/assets/modules/pos_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
commission_plan/static/description/assets/screenshots/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
commission_plan/static/description/assets/screenshots/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
commission_plan/static/description/assets/screenshots/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
commission_plan/static/description/assets/screenshots/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
commission_plan/static/description/assets/screenshots/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
commission_plan/static/description/assets/screenshots/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

BIN
commission_plan/static/description/assets/screenshots/7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

BIN
commission_plan/static/description/assets/screenshots/8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
commission_plan/static/description/assets/screenshots/CRM-Dashboard-user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

BIN
commission_plan/static/description/assets/screenshots/dash_screenshot-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
commission_plan/static/description/assets/screenshots/dash_screenshot-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
commission_plan/static/description/assets/screenshots/dash_screenshot-22.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
commission_plan/static/description/assets/screenshots/dash_screenshot-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
commission_plan/static/description/assets/screenshots/dash_screenshot-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
commission_plan/static/description/assets/screenshots/dash_screenshot-5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
commission_plan/static/description/assets/screenshots/dash_screenshot-6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
commission_plan/static/description/assets/screenshots/hero.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

BIN
commission_plan/static/description/assets/screenshots/hero_kit.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 KiB

BIN
commission_plan/static/description/assets/screenshots/output.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
commission_plan/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
commission_plan/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

755
commission_plan/static/description/index.html

@ -0,0 +1,755 @@
<div style="background-color: #714B67; height: 810px; width: 100%; padding: 15px; position: relative;">
<!-- TITLE BAR -->
<div class="d-flex align-items-center justify-content-between"
style="border-bottom: 1px solid #875A7B; padding: 15px; display: flex; justify-content: space-between; align-items: center;">
<img src="assets/misc/cybrosys-logo.png" width="42" height="42" style="width: 42px; height: 42px;"/>
<div>
<div
style="color: #7C7BAD; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;"
class="mr-2">
<i class="fa fa-check mr-1"></i>Community
</div>
<div
style="color: #875A7B; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;"
class="mr-2">
<i class="fa fa-check mr-1"></i>Enterprise
</div>
<div
style="color: #017E84; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;"
class="mr-2">
<i class="fa fa-check mr-1"></i>Odoo.sh
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12">
<!-- APP HERO -->
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">
Odoo CRM Commission Plan</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">CRM Commission Plan for odoo16.</p>
<!-- END OF APP HERO -->
<img src="assets/screenshots/hero.gif" class="img-responsive"
style="width: 850px; margin-left: 156px; margin-right: auto;"/>
</div>
</div>
</div>
</div>
<!-- END OF TITLE BAR -->
<div class="container" style="padding: 4rem 1.5rem !important">
<div class="row">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin-bottom: 2rem !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-compass mr-2"></i>Explore this module
</h2>
</div>
<div class="col-md-6">
<a href="#overview" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Overview</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
Learn more about this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
<div class="col-md-6">
<a href="#features" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Features</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
View features of this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
<div class="col-md-6">
<a href="#screenshots" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Screenshots</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
See key screenshots of this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
</div>
<div class="row " id="overview">
<div class="col-sm-12 col-md-12 col-lg-12 px-4">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-size: 2rem; font-weight: 700 !important; color: #21272B !important;">
Overview</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 30px !important; margin-left: 0 !important; margin-bottom: 2rem !important;" />
<p class="mt-4"
style="font-size: 1.1rem !important; color: #282F33 !important; font-weight: 400 !important; line-height: 1.85 !important">
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.<br />
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.
</p>
</div>
</div>
<div class="row" id="features" style="margin-top: 3rem;">
<div class="col-sm-12 col-md-12 col-lg-12 px-4">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-size: 2rem; font-weight: 700 !important; color: #21272B !important;">
Features</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 30px !important; margin-left: 0 !important; margin-bottom: 2rem !important;" />
<div class="row">
<div class="col-sm-12 col-md-6">
<div class="d-flex my-5"
style="padding-bottom: 1.3rem !important; border-bottom: 2px solid #f0f0f0;">
<img src="assets/icons/check.png" width="24px" height="24px" class="mr-2">
<h3 style="font-size: 1.2rem !important;">Craft custom Commission to Salesperson and Sales
Team</h3>
</div>
<div class="d-flex my-5"
style="padding-bottom: 1.3rem !important; border-bottom: 2px solid #f0f0f0;">
<img src="assets/icons/check.png" width="24px" height="24px" class="mr-2">
<h3 style="font-size: 1.2rem !important;">Draft Commissions based on Revenue and respective
Product</h3>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="d-flex my-5"
style="padding-bottom: 1.3rem !important; border-bottom: 2px solid #f0f0f0;">
<img src="assets/icons/check.png" width="24px" height="24px" class="mr-2">
<h3 style="font-size: 1.2rem !important;">Define Commission based on Product Category</h3>
</div>
<div class="d-flex my-5"
style="padding-bottom: 1.3rem !important; border-bottom: 2px solid #f0f0f0;">
<img src="assets/icons/check.png" width="24px" height="24px" class="mr-2">
<h3 style="font-size: 1.2rem !important;">Informative Commission Plan report</h3>
</div>
</div>
</div>
</div>
</div>
<div class="row " id="configuration">
<div class="col-sm-12 col-md-12 col-lg-12 px-4">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-size: 2rem; font-weight: 700 !important; color: #21272B !important;">
Configuration</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 30px !important; margin-left: 0 !important; margin-bottom: 2rem !important;" />
<p class="mt-4"
style="font-size: 1.1rem !important; color: #282F33 !important; font-weight: 400 !important; line-height: 1.85 !important">
<b>For creating new commission plans:</b><br />
<ol>
<li>
<b>Creating new commissions:</b><br />
<p>Initially Create a new commission and Choose a name to distinguish
that type<br /></p>
</li>
<li>
<b>Select the type of the Commission:</b><br />
<p><b>Product-based:</b> Commissions are calculated as the percentage of
the price based on the selected product in the form.<br /></p>
<p><b>Revenue-based:</b> A certain percentage of revenue is given as
Commission to the Salesperson<br /></p>
<p>
<b>Straight revenue:</b> Commissions are calculated using a fixed
percentage of the revenue sold. You can fill the percentage in the field "Commission
rate".<br />
</p>
<p>
<b>Graduated revenue:</b> Commissions are calculated as a percentage
of the revenue generated at amount intervals.<br />
</p>
<p>
You can fill in the amount intervals and the percentages in the
"Graduated Revenue Commission" field.<br />
</p>
</li>
</ol>
<p class="mt-4"
style="font-size: 1.1rem !important; color: #282F33 !important; font-weight: 400 !important; line-height: 1.85 !important">
<b>For adding Commission in Salesperson & Sales team:</b><br />
</p>
<b>Go to CRM -> Configuration -> Salesperson or Sales team</b>
<ul>
<li>Edit the Salesperson or Sales team</li>
<li>Choose a commission type</li>
<li>Save it</li>
</ul>
<p class="mt-4"
style="font-size: 1.1rem !important; color: #282F33 !important; font-weight: 400 !important; line-height: 1.85 !important">
<b>For printing Commission in XLSX report:</b><br />
</p>
<b>Go to CRM -> Configuration -> Salesperson or Sales team</b>
<ul>
<li>CRM -> Reporting -> Commission Report</li>
</ul>
</div>
</div>
<div class="row mt-5" id="screenshots">
<div class="col-sm-12 col-md-12 col-lg-12 px-4">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-size: 2rem; font-weight: 700 !important; color: #21272B !important;">
Screenshots</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 30px !important; margin-left: 0 !important; margin-bottom: 2rem !important;" />
<div class="mt-5">
<div class="d-flex mb-2" style="padding-bottom: 0.5rem !important;">
<img src="assets/icons/chevron.png" width="20px" height="20px" class="mr-2"
style="margin-top: 4px !important;">
<h3>Commission Plan</h3>
</div>
<p>The Commission Plan window can be accessed from the Configuration menu of the module and
select
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.</p>
<img src="assets/screenshots/1.png" class="img-responsive img-thumbnail border">
</div>
<div class="mt-5">
<div class="d-flex mb-2" style="padding-bottom: 0.5rem !important;">
<img src="assets/icons/chevron.png" width="20px" height="20px" class="mr-2"
style="margin-top: 4px !important;">
<h3>Commission Plan based on Product Category</h3>
</div>
<p>The Commission Plan Creation window can be accessed from the Commission Plan menu from the configuration menu 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.</p>
<p>You can also choose the commission amount type as fixed or percentage for each product.</p>
<img src="assets/screenshots/2.png" class="img-responsive img-thumbnail border">
</div>
<div class="mt-5">
<div class="d-flex mb-2" style="padding-bottom: 0.5rem !important;">
<img src="assets/icons/chevron.png" width="20px" height="20px" class="mr-2"
style="margin-top: 4px !important;">
<h3>Revenue-based Commission Plan: Straight Revenue Commission Plan</h3>
</div>
<p>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.<br />
While Creating a Straight Revenue Commission plan the Revenue type can be selected as
Straight
Commission. Further, the commission rate can be defined under the Straight Revenue
Commission
tab.</p>
<p>The commission amount type can be chosen as fixed or percentage. You need to enter the percentage rate if you choose percentage type.</p>
<img src="assets/screenshots/3.png" class="img-responsive img-thumbnail border">
<p>You need to enter the fixed amount if you choose the fixed type.</p>
<img src="assets/screenshots/4.png" class="img-responsive img-thumbnail border">
</div>
<div class="mt-5">
<div class="d-flex mb-2" style="padding-bottom: 0.5rem !important;">
<img src="assets/icons/chevron.png" width="20px" height="20px" class="mr-2"
style="margin-top: 4px !important;">
<h3>Revenue-based Commission Plan: Graduated Revenue Commission Plan</h3>
</div>
<p>While Creating a Graduated Revenue Commission Plan the Commission type can be selected as
Graduated Commission. Further, the commission rate/ commission amount can be defined under the Graduated
Revenue
Commission tab.</p>
<img src="assets/screenshots/5.png" class="img-responsive img-thumbnail border">
</div>
<div class="mt-5">
<div class="d-flex mb-2" style="padding-bottom: 0.5rem !important;">
<img src="assets/icons/chevron.png" width="20px" height="20px" class="mr-2"
style="margin-top: 4px !important;">
<h3>Assigning Commission Plan for Salesperson</h3>
</div>
<p>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.</p>
<img src="assets/screenshots/6.png" class="img-responsive img-thumbnail border">
</div>
<div class="mt-5">
<div class="d-flex mb-2" style="padding-bottom: 0.5rem !important;">
<img src="assets/icons/chevron.png" width="20px" height="20px" class="mr-2"
style="margin-top: 4px !important;">
<h3>Assigning Commission Plan for Sales Team</h3>
</div>
<p>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.</p>
<img src="assets/screenshots/7.png" class="img-responsive img-thumbnail border">
</div>
<div class="mt-5">
<div class="d-flex mb-2" style="padding-bottom: 0.5rem !important;">
<img src="assets/icons/chevron.png" width="20px" height="20px" class="mr-2"
style="margin-top: 4px !important;">
<h3>Print the Commission Plan Report in XLSX Format</h3>
</div>
<p>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.</p>
<img src="assets/screenshots/8.png" class="img-responsive img-thumbnail border">
</div>
</div>
</div>
<!-- SUGGESTED PRODUCTS -->
<div class="row mt-3">
<div class="col-lg-12 d-flex flex-column justify-content-center" style="padding: 2.5rem 1rem !important;">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-size: 2rem; font-weight: 700 !important; color: #21272B !important;">
Suggested Products</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 30px !important; margin-left: 0 !important; margin-bottom: 2rem !important;" />
<div id="demo1" class="row carousel slide mt-4 data-ride=">
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active" style="min-height:0px">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/export_stockinfo_xls/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/export_image.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/dashboard_pos/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/pos_image.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/custom_gantt_view/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/gantt_image.png">
</div>
</a>
</div>
</div>
<div class="carousel-item" style="min-height:0px">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/base_account_budget/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/budget_image.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/task_deadline_reminder/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/deadline_image.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/dynamic_accounts_report/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/dynamic_financial.png">
</div>
</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo1" data-slide="prev"
style="left:-25px;width: 35px;color: #000;"> <span class="carousel-control-prev-icon"><i
class="fa fa-chevron-left" style="font-size:24px"></i></span> </a> <a
class="carousel-control-next" href="#demo1" data-slide="next"
style="right:-25px;width: 35px;color: #000;">
<span class="carousel-control-next-icon"><i class="fa fa-chevron-right"
style="font-size:24px"></i></span>
</a>
</div>
</div>
</div>
<!-- END OF SUGGESTED PRODUCTS -->
<!-- OUR SERVICES -->
<section class="container" style="margin-top: 6rem !important;">
<div class="row">
<div class="col-lg-12">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-size: 2rem; font-weight: 700 !important; color: #21272B !important;">
Our Services</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 30px !important; margin-left: 0 !important; margin-bottom: 2rem !important;" />
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #1dd1a1 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/cogs.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Customization</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/wrench.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/lifebuoy.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Support</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/user.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Hire
Odoo
Developer</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/puzzle.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Integration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/update.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Migration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/consultation.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Consultancy</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/training.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/license.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Licensing Consultancy</h6>
</div>
</div>
</section>
<!--END OF OUR SERVICES -->
<!-- OUR INDUSTRIES -->
<section class="container" style="margin-top: 6rem !important;">
<div class="row">
<div class="col-lg-12">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-size: 2rem; font-weight: 700 !important; color: #21272B !important;">
Our Industries</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 30px !important; margin-left: 0 !important; margin-bottom: 2rem !important;" />
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/trading-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Trading
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easily procure
and
sell your products</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/pos-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
POS
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easy
configuration
and convivial experience</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/education-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Education
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
A platform for
educational management</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/manufacturing-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Manufacturing
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Plan, track and
schedule your operations</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/ecom-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
E-commerce &amp; Website
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Mobile
friendly,
awe-inspiring product pages</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/service-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Service Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Keep track of
services and invoice</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/restaurant-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Restaurant
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Run your bar or
restaurant methodically</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/hotel-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Hotel Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
An
all-inclusive
hotel management application</p>
</div>
</div>
</div>
</section>
<!-- END OF OUR INDUSTRIES -->
<!-- FOOTER -->
<!-- Footer Section -->
<section class="container" style="margin: 5rem auto 2rem;">
<div class="row" style="max-width:1540px;">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Need Help?</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;" />
</div>
</div>
<!-- Contact Cards -->
<!-- SUPPORT -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/customer-support.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Support
</h2>
</div>
<div class="container mt-5">
<div class="row">
<div class="col-sm-12 col-md-6">
<div style="background-color: #F6F8F9; padding: 30px; display: flex; align-items: center;">
<div class="mr-4"
style="background-color: #714B67; display: inline-block; height: 70px; width: 70px; display: flex; align-items: center; justify-content: center;">
<img src="assets/misc/support.png" height="48" width="48"
style="width: 42px; height: 42px;"/>
</div>
<div>
<h4>Need Help?</h4>
<p style="line-height: 100%;">Got questions or need help?
Get in touch.</p>
<a href="mailto:odoo@cybrosys.com">
<p style="font-weight: 400; font-size: 28px; line-height: 80%; color: #714B67;">
odoo@cybrosys.com</p>
</a>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div style="background-color: #F6F8F9; padding: 30px; display: flex; align-items: center;">
<div class="mr-4"
style="background-color: #2AC44D; display: inline-block; height: 70px; width: 70px; display: flex; align-items: center; justify-content: center;">
<img src="assets/misc/whatsapp.png" height="52" width="52"
style="width: 52px; height: 52px;"/>
</div>
<div>
<h4>WhatsApp</h4>
<p style="line-height: 100%;">Say hi to us on WhatsApp!</p>
<a href="https://api.whatsapp.com/send?phone=918606827707">
<p style="font-weight: 400; font-size: 28px; line-height: 80%; color: #714B67;">
+91 86068
27707</p>
</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 my-5 d-flex justify-content-center align-items-center">
<img src="assets/misc/logo.png" width="144" height="31"
style="width:144px; height: 31px; margin-top: 40px;"/>
</div>
</div>
</div>
</section>
<!-- END OF FOOTER -->
</div>

21
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;
}
});

123
commission_plan/views/crm_commission_views.xml

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!--commission plan tree view-->
<record id="crm_commission_view_tree" model="ir.ui.view">
<field name="name">crm.commission.tree</field>
<field name="model">crm.commission</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="type"/>
</tree>
</field>
</record>
<!--commission plan form view-->
<record id="crm_commission_view_form" model="ir.ui.view">
<field name="name">crm.commission.form</field>
<field name="model">crm.commission</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="name"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="active"/>
<field name="type"/>
<field name="revenue_type"
attrs="{'invisible':[('type', '=', 'product')]}"/>
</group>
</group>
<notebook>
<page string="Product Wise"
attrs="{'invisible':[('type', '!=', 'product')]}">
<field name="product_comm_ids">
<tree editable="Top" multi_edit="1">
<field name="category_id" width="23%"/>
<field name="product_id" width="20%"
domain="[('categ_id','in',category_ids)]"/>
<field name="category_ids"
invisible="1"/>
<field name="commission_amount_type"
width="18%"/>
<field name="percentage"
attrs="{'invisible' : [('commission_amount_type', '=', 'fixed')]}"
width="10"/>
<field name="fixed_amount"
attrs="{'invisible' : [('commission_amount_type', '!=', 'fixed')]}"
width="15"/>
<field name="amount"
attrs="{'invisible' : [('commission_amount_type', '=', 'fixed')]}"
width="14"/>
</tree>
</field>
</page>
<page string="Straight Revenue Commission"
attrs="{'invisible' : ['|','|',('type', '=', 'product'),('revenue_type', '=', False),('revenue_type', '=', 'graduated')]}">
<group>
<field name="straight_commission_type"/>
<field name="straight_commission_fixed"
attrs="{'invisible' : [('straight_commission_type', '!=', 'fixed')]}"/>
<field name="straight_commission_rate"
string="Commission rate (%)"
attrs="{'invisible' : ['|','|','|',('straight_commission_type', '=', 'fixed'),('type', '=', 'product'),('revenue_type', '=', False),('revenue_type', '=', 'graduated')]}"/>
</group>
</page>
<page string="Graduated Revenue Commission"
attrs="{'invisible' : ['|','|',('type', '=', 'product'),('revenue_type', '=', False),('revenue_type', '=', 'straight')]}">
<field name="revenue_grd_comm_ids">
<tree editable="Top" create="1" multi_edit="1">
<field name="sequence" width="10%"/>
<field name="amount_from" width="15%"/>
<field name="amount_to" width="15%"/>
<field name="graduated_amount_type"
widget="selection"
style="max-width:200px !important;"
width="20%"/>
<field name="graduated_fixed_amount"
style="min-width:200px !important;"
attrs="{'invisible' : [('graduated_amount_type', '!=', 'fixed')]}"
width="20%"/>
<field name="graduated_commission_rate"
style="min-width:200px !important;"
attrs="{'invisible' : [('graduated_amount_type', '=', 'fixed')]}"
width="20%"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
<!-- crm commission plan action-->
<record id="commission_plan_action" model="ir.actions.act_window">
<field name="name">CRM Commission Plan</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.commission</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create New Commission Plan!
</p>
</field>
</record>
<menuitem id="crm_commission_plan_menu"
name="Commission Plans"
parent="crm.crm_menu_config"
action="commission_plan_action"
sequence="13"/>
</odoo>

14
commission_plan/views/crm_team_views.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- commission plan is added to the crm team-->
<record id="crm_team_view_form" model="ir.ui.view">
<field name="name">crm.team.inherit.commission.plan</field>
<field name="model">crm.team</field>
<field name="inherit_id" ref="sales_team.crm_team_view_form"/>
<field name="arch" type="xml">
<field name="alias_contact" position="after">
<field name="commission_id"/>
</field>
</field>
</record>
</odoo>

26
commission_plan/views/res_users_views.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!--commission field is added to res.users-->
<record id="view_users_simple_form" model="ir.ui.view">
<field name="name">res.users.inherit.commission.plan</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_simple_form"/>
<field name="arch" type="xml">
<field name="mobile" position="after">
<field name="commission_id"/>
</field>
</field>
</record>
<record id="res_users_action" model="ir.actions.act_window">
<field name="name">Sales Persons</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.users</field>
<field name="domain">[('share','=',False)]</field>
<field name="view_mode">tree,kanban,form</field>
</record>
<menuitem id="crm_menu_sales_persons"
name="Sales Persons"
parent="crm.crm_menu_config"
action="res_users_action"
sequence="6"/>
</odoo>

22
commission_plan/wizard/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import commission_report

476
commission_plan/wizard/commission_report.py

@ -0,0 +1,476 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Abhin K(odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
import io
import json
from odoo import api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools import date_utils
try:
from odoo.tools.misc import xlsxwriter
except ImportError:
import xlsxwriter
class CommissionReportWizard(models.TransientModel):
"""commission.wizard model is created and shown as the wizard window"""
_name = 'commission.wizard'
_description = 'Commission 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 = bool(self.salesperson_ids)
@api.onchange('sales_team_ids')
def _onchange_sales_team_ids(self):
"""Function for hide a field base on values"""
self.is_sales_team = bool(self.sales_team_ids)
@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 action_print_xlsx_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)])
total_list = []
commission_list = []
user_commission_name = []
user_commission_salesperson = []
user_obj = user_sale_orders.mapped('user_id'). \
sorted(key=lambda d: d.id)
user_sale_orders_dict = {
user: user_sale_orders.filtered(lambda rec: rec.user_id == user)
for user in user_obj}
for user, user_sale_orders in user_sale_orders_dict.items():
commission_id = user.commission_id
if not commission_id:
continue
if self.date_to and self.date_from:
filtered_order_lines = user_sale_orders.filtered(
lambda rec: self.date_from <= rec.date_order.date()
<= self.date_to and rec.date_order.date()
>= commission_id.date_from
).mapped('order_line')
elif not self.date_to and self.date_from:
filtered_order_lines = user_sale_orders \
.filtered(lambda rec: rec.date_order.date() >=
self.date_from >=
commission_id.date_from)\
.mapped('order_line')
elif self.date_to and not self.date_from:
filtered_order_lines = user_sale_orders \
.filtered(lambda rec: rec.date_order.date() <=
self.date_to <=
commission_id.date_to)\
.mapped('order_line')
else:
filtered_order_lines = user_sale_orders.mapped(
'order_line')
filtered_order_lines_commission_total = sum(
filtered_order_lines.mapped('price_subtotal'))
if commission_id.type == 'product':
self._calculate_product_commission(
filtered_order_lines,
total_list, commission_list,
user_commission_salesperson, user, commission_id,
user_commission_name
)
elif commission_id.type == 'revenue' and \
commission_id.revenue_type == 'graduated':
for rule in commission_id.revenue_grd_comm_ids:
self._calculate_graduated_commission(
commission_list,
user_commission_salesperson,
total_list, user, commission_id, rule,
filtered_order_lines_commission_total,
user_commission_name
)
elif commission_id.type == 'revenue' and \
commission_id.revenue_type == 'straight':
self._calculate_straight_commission(
commission_id,
filtered_order_lines_commission_total,
commission_list,
user_commission_name,
user_commission_salesperson,
total_list, user
)
# 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_sale_orders = self.env['sale.order'].search(
[('team_id', 'in', self.sales_team_ids.ids)])
team_obj = team_sale_orders.mapped('user_id'). \
sorted(key=lambda d: d.id)
team_sale_orders_dict = {
team_user: self._filter_sale_orders_by_user(team_sale_orders,
team_user) for
team_user in team_obj}
commission_total, commission, commission_name, commission_salesperson, \
commission_sales_team = self._calculate_commissions(
team_sale_orders_dict
)
# 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)
if data.get('date_from'):
sheet.write('D2', 'Date From: ' + data['date_from'],
date_format)
if data.get('date_to'):
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)
if data.get('date_from'):
sheet.write('E2', 'Date From: ' + data['date_from'],
date_format)
if data.get('date_to'):
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()
def _calculate_product_commission(self, filtered_order_lines,
total_list, commission_list,
user_commission_salesperson, *args):
"""Returns the calculated product commission"""
user, commission_id, user_commission_name = args
commission_products = commission_id.product_comm_ids.mapped(
'product_id')
commission_category = commission_id.product_comm_ids.mapped(
'category_id')
prod_commission = filtered_order_lines.filtered(
lambda
rec: rec.product_id.id in commission_products.ids or
rec.product_id.categ_id.id in commission_category.ids
)
for rule in commission_id.product_comm_ids:
product_order_line = prod_commission.filtered(
lambda rec: rec.product_id == rule.product_id or
rec.product_id.categ_id.id == rule.category_id.id)
total_price = sum(product_order_line.mapped('price_subtotal'))
product_commission = (total_price * rule.percentage) / 100 if \
rule.commission_amount_type == 'percentage' else \
rule.fixed_amount
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 and
rule.commission_amount_type == 'percentage'
else product_commission
)
def _calculate_graduated_commission(self,
commission_list,
user_commission_salesperson,
total_list, *args
):
"""Returns the calculated Graduated commission"""
user, commission_id, rule, filtered_order_lines_commission_total, \
user_commission_name = args
graduated_commission = (
filtered_order_lines_commission_total
* rule.graduated_commission_rate
) / 100 if rule.amount_from \
<= filtered_order_lines_commission_total < rule.amount_to else \
rule.graduated_fixed_amount
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)
def _calculate_straight_commission(self, commission_id,
filtered_order_lines_commission_total,
commission_list,
*args):
"""Returns the calculated Straight commission"""
user_commission_name, \
user_commission_salesperson, total_list, user = args
straight_commission = (
filtered_order_lines_commission_total
* commission_id.straight_commission_rate
) / 100 if \
commission_id.straight_commission_type == 'percentage' else \
commission_id.straight_commission_fixed
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)
def _filter_sale_orders_by_user(self, team_sale_orders, team_user):
"""Returns the filtered team_sale_orders using the team_users"""
return team_sale_orders.filtered(lambda rec: rec.user_id == team_user)
def _calculate_commissions(self, team_sale_orders_dict):
"""Returns the calculated commissions"""
commission_total = []
commission = []
commission_name = []
commission_salesperson = []
commission_sales_team = []
for team_user, team_sale_orders in team_sale_orders_dict.items():
commissions_id = team_user.commission_id or \
team_user.sale_team_id.commission_id
if commissions_id:
if self.date_to and self.date_from:
filtered_order_lines = team_sale_orders.filtered(
lambda rec: self.date_from <= rec.date_order.date()
<= self.date_to and rec.date_order.date()
>= commissions_id.date_from
).mapped('order_line')
elif not self.date_to and self.date_from:
filtered_order_lines = team_sale_orders \
.filtered(lambda rec: rec.date_order.date() >=
self.date_from >=
commissions_id.date_from)\
.mapped('order_line')
elif self.date_to and not self.date_from:
filtered_order_lines = team_sale_orders \
.filtered(lambda rec: rec.date_order.date() <=
self.date_to <=
commissions_id.date_to)\
.mapped('order_line')
else:
filtered_order_lines = team_sale_orders.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.mapped(
'product_id').ids
commission_category = commissions_id.product_comm_ids.mapped(
'category_id').ids
prod_commission = filtered_order_lines.filtered(
lambda rec: rec.product_id.id in commission_products or
rec.product_id.categ_id.id in commission_category
)
for rules in commissions_id.product_comm_ids:
product_order_line = prod_commission.filtered(
lambda rec: rec.product_id == rules.product_id or
rec.product_id.categ_id.id == rules.category_id.id)
total_price = sum(
product_order_line.mapped('price_subtotal')
)
product_commission = (
total_price * rules.percentage
) / 100 if \
rules.commission_amount_type == 'percentage' else \
rules.fixed_amount
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
and rules.commission_amount_type == 'percentage'
else 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 if \
rules.graduated_amount_type == 'percentage' \
else rules.graduated_fixed_amount
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 if \
commissions_id.straight_commission_type == \
'percentage' else \
commissions_id.straight_commission_fixed
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
)
return commission_total, commission, commission_name, \
commission_salesperson, commission_sales_team

47
commission_plan/wizard/commission_wizard_views.xml

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- commission wizard view action and menu-item is defined here-->
<record id="commission_wizard_view_form" model="ir.ui.view">
<field name="name">commission.wizard.form</field>
<field name="model">commission.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="is_sales_person" attrs="{'invisible':True}"/>
<field name="is_sales_team" attrs="{'invisible':True}"/>
<field name="sales_team_ids" widget="many2many_tags" options="{'no_create': True}"
attrs="{'invisible':[('is_sales_person', '=', True)]}"/>
<field name="salesperson_ids" widget="many2many_tags" options="{'no_create': True}"
attrs="{'invisible': [('is_sales_team', '=', True)]}"/>
</group>
</group>
</sheet>
<footer>
<button name="action_print_xlsx_report" string="Print XLSX"
type="object" class="oe_highlight"/>
<button string="Cancel" class="btn btn_default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="commission_wizard_action" model="ir.actions.act_window">
<field name="name">Commission Report</field>
<field name="res_model">commission.wizard</field>
<field name="view_mode">form</field>
<field name="view_id" ref="commission_wizard_view_form"/>
<field name="target">new</field>
</record>
<menuitem id="commission_excel_report_root"
name="Commission Report "
parent="crm.crm_menu_report"
action="commission_wizard_action"
sequence="4"/>
</odoo>
Loading…
Cancel
Save