@ -0,0 +1,51 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Sales Target VS Achievement |
|||
=========================== |
|||
This module allow set Individual Salesperson Target and compute its achievement |
|||
and Sales Team target. |
|||
|
|||
Configuration |
|||
============= |
|||
The user should be added either to the security group: Sales Target Admin(Sales Target and Achievement) |
|||
or Users(Sales Target and Achievement) inorder to get access to the new menus. |
|||
|
|||
License |
|||
------- |
|||
Lesser General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V17) Adarsh K, |
|||
(V16) Farha VC, |
|||
(V18) Busthana |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://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>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.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 models |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.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": "Sales Target VS Achievement", |
|||
"version": "18.0.1.0.0", |
|||
'category': 'Sales, CRM', |
|||
"summary": "Sales Target and Achievements based on Salesperson's " |
|||
"individual target", |
|||
"description": """Based on Salesperson's individual target, Sales Target |
|||
and Achievement calculation for Salesperson and CRM Sales Team""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['base', 'sale_management', 'crm', 'mail'], |
|||
'data': ['security/sales_target_vs_achievement_groups.xml', |
|||
'security/ir.model.access.csv', |
|||
'views/target_achieve_views.xml', |
|||
'views/crm_team_views.xml'], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,7 @@ |
|||
## Module <sales_target_vs_achievement> |
|||
|
|||
#### 10.01.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
|
|||
- Initial commit for Sales Target VS Achievement |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.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 crm_team |
|||
from . import target_achieve |
@ -0,0 +1,43 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.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 CrmTeam(models.Model): |
|||
"""Inheriting CrmTeam class to set the Team Target and compute its value |
|||
based on the CRM Team member assigned""" |
|||
_inherit = 'crm.team' |
|||
|
|||
team_target = fields.Float(string="Team Target", |
|||
help="Automatically calculated value for every " |
|||
"Sales Team based on the individual " |
|||
"targets of the Salespersons") |
|||
|
|||
@api.model |
|||
def default_get(self, fields): |
|||
"""Calculate the team target's value called from the onchange of |
|||
sale_user_id or user_target fields in target form""" |
|||
self.team_target = 0.0 |
|||
for record in self.env['target.achieve'].search([ |
|||
('team_id', '=', self.id)]): |
|||
self.team_target = self.team_target + record.user_target |
|||
return super(CrmTeam, self).default_get(fields) |
@ -0,0 +1,127 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.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 TargetAchieve(models.Model): |
|||
"""Target Achieve class to set the target and compute its achievement |
|||
based on the span given for the CRM Team member and their Team""" |
|||
_name = 'target.achieve' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_description = 'Target Achieve' |
|||
|
|||
name = fields.Char(string='Name', compute='_compute_name', store=True, |
|||
help="Auto created name which is a combination" |
|||
" of Salesperson, timespan and team name.") |
|||
sale_user_id = fields.Many2one('crm.team.member', |
|||
string="Salesperson", required=True, |
|||
tracking=True, |
|||
help="Team member to whom the target is set") |
|||
user_target = fields.Float('Salesperson Target', required=True, |
|||
tracking=True, |
|||
help="Value for the personal target to reach.", |
|||
copy=False) |
|||
time_span = fields.Selection( |
|||
[('daily', 'Daily'), |
|||
('monthly', 'Monthly'), |
|||
('yearly', 'Yearly')], string='Time Span', default='monthly', |
|||
required=True, tracking=True, |
|||
help="The target can be set Daily/Monthly/Yearly with this field.") |
|||
team_id = fields.Many2one('crm.team', |
|||
related='sale_user_id.crm_team_id', |
|||
string="Sales Team", |
|||
help="Sales Team in which the user is a member.", |
|||
store=True) |
|||
team_target = fields.Float(string="Team Target", |
|||
compute='_compute_team_target', |
|||
help="Auto calculated value of Sales team.") |
|||
person_achieved_amt = fields.Float(string='Person Achieved Amount', |
|||
help="Auto calculated value taken from" |
|||
"sale orders for each Salesperson.", |
|||
compute='_compute_achieved_amt') |
|||
team_achieved_amt = fields.Float(string='Team Achieved Amount', |
|||
store=True, |
|||
compute_sudo=True, |
|||
help="Auto calculated value taken from" |
|||
"sale orders for each sales team.", |
|||
compute='_compute_achieved_amt') |
|||
currency_id = fields.Many2one('res.currency', |
|||
string='Currency', |
|||
default=lambda self: |
|||
self.env.company.currency_id, |
|||
help="Company currency field to show the" |
|||
" monetary field.") |
|||
_sql_constraints = [ |
|||
('unique_combination', 'unique (name)', |
|||
"Similar Target for the same member already exists."), |
|||
('check_user_target', |
|||
'CHECK(user_target > 0.0)', |
|||
"The Salesperson Target cannot be zero.",), |
|||
] |
|||
|
|||
@api.depends('sale_user_id', 'user_target') |
|||
def _compute_team_target(self): |
|||
"""For every change in Salesperson and Target set, the Sales Team |
|||
Target is re-calculated and made visible in Sales Team view""" |
|||
for rec in self: |
|||
for team in self.env['crm.team'].browse(rec.team_id.id): |
|||
team.default_get('team_id') |
|||
rec.team_target = rec.team_target + rec.user_target |
|||
|
|||
@api.model |
|||
def _compute_achieved_amt(self): |
|||
"""Compute the Achieved sales amount for Member and Sales Team |
|||
separately based on the span selected""" |
|||
for rec in self: |
|||
rec.person_achieved_amt = rec.team_achieved_amt = 0.0 |
|||
domain = [('state', '=', 'sale')] |
|||
if rec.time_span == 'daily': |
|||
domain.append( |
|||
('date_order', '>=', fields.Date.today())) |
|||
elif rec.time_span == 'monthly': |
|||
domain.append( |
|||
('date_order', '>=', fields.Date.today().replace(day=1))) |
|||
elif rec.time_span == 'yearly': |
|||
domain.append( |
|||
('date_order', '>=', fields.Date.today().replace(month=1, day=1))) |
|||
|
|||
orders = self.env['sale.order'].search(domain) |
|||
|
|||
for order in orders: |
|||
if order.user_id.id == rec.sale_user_id.user_id.id: |
|||
rec.person_achieved_amt += order.amount_total |
|||
if order.team_id.id == rec.team_id.id: |
|||
rec.team_achieved_amt += order.amount_total |
|||
|
|||
@api.depends('sale_user_id', 'time_span', 'team_id') |
|||
def _compute_name(self): |
|||
"""Compute the rec_name so that the similar kind of Target setting |
|||
can be avoided""" |
|||
for record in self: |
|||
record.name = f"{record.sale_user_id.name}:{record.team_id.name}" |
|||
|
|||
@api.ondelete(at_uninstall=False) |
|||
def delete_record(self): |
|||
""" Deletion of a record must reset the Sales Team target""" |
|||
for record in self: |
|||
record.team_id.update({ |
|||
'team_target': record.team_id.team_target - record.user_target}) |
|
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Adding Module category for the roles--> |
|||
<record id="module_sales_target" model="ir.module.category"> |
|||
<field name="name">Sales Target and Achievement</field> |
|||
<field name="description">User access rights</field> |
|||
<field name="sequence">20</field> |
|||
</record> |
|||
<!-- To add the user group Sales Target Admin with all access--> |
|||
<record id="sales_target_vs_achievement_group_sales_target_admin" |
|||
model="res.groups"> |
|||
<field name="name">Sales Target Admin</field> |
|||
<field name="category_id" ref="module_sales_target"/> |
|||
</record> |
|||
<!-- To add the user group Users with limited access--> |
|||
<record id="sales_target_vs_achievement_group_sales_target_user" |
|||
model="res.groups"> |
|||
<field name="name">Users</field> |
|||
<field name="category_id" ref="module_sales_target"/> |
|||
</record> |
|||
</odoo> |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 225 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 729 KiB |
After Width: | Height: | Size: 47 KiB |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Show a new field Team target which is automatically computed |
|||
based on the corresponding team's individual Salesperson's target in the |
|||
Sales team form view--> |
|||
<record id="crm_team_view_form" model="ir.ui.view"> |
|||
<field name="name">crm.team.view.form.inherit.sales.target.vs.achievement</field> |
|||
<field name="model">crm.team</field> |
|||
<field name="inherit_id" ref="sales_team.crm_team_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//notebook" position="before"> |
|||
<group> |
|||
<field name="team_target"/> |
|||
</group> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |