From f39ff6584d3b88644f3d463de89de46b93bfaac7 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Wed, 27 Jul 2022 11:58:16 +0530 Subject: [PATCH] [UPDT] Bug Fix 'crm_dashboard' --- crm_dashboard/__manifest__.py | 2 +- crm_dashboard/doc/RELEASE_NOTES.md | 7 ++++++- crm_dashboard/models/crm_dashboard.py | 21 +++++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/crm_dashboard/__manifest__.py b/crm_dashboard/__manifest__.py index 0379f078b..2419bd051 100644 --- a/crm_dashboard/__manifest__.py +++ b/crm_dashboard/__manifest__.py @@ -24,7 +24,7 @@ 'description': """CRM Dashboard, Detailed Dashboard View for CRM, CRM, Dashboard, odoo14""", 'summary': """Detailed Dashboard View for CRM""", 'category': 'Sales', - 'version': '14.0.1.0.1', + 'version': '14.0.1.0.2', 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', diff --git a/crm_dashboard/doc/RELEASE_NOTES.md b/crm_dashboard/doc/RELEASE_NOTES.md index 813f9ec73..74a11c2f3 100644 --- a/crm_dashboard/doc/RELEASE_NOTES.md +++ b/crm_dashboard/doc/RELEASE_NOTES.md @@ -3,4 +3,9 @@ #### 17.09.2021 #### Version 14.0.1.0.0 #### ADD -- Initial commit for CRM Dashboard Module \ No newline at end of file +- Initial commit for CRM Dashboard Module + +#### 15.07.2022 +#### Version 14.0.1.0.2 +#### FIX +- Bug fixes for CRM Dashboard Module \ No newline at end of file diff --git a/crm_dashboard/models/crm_dashboard.py b/crm_dashboard/models/crm_dashboard.py index 55eb66fa5..2214aba04 100644 --- a/crm_dashboard/models/crm_dashboard.py +++ b/crm_dashboard/models/crm_dashboard.py @@ -120,7 +120,7 @@ class CRMLead(models.Model): """Sales Activity Pie""" self._cr.execute('''select mail_activity_type.name,COUNT(*) from mail_activity inner join mail_activity_type on mail_activity.activity_type_id = mail_activity_type.id - where res_model = 'crm.lead' GROUP BY mail_activity_type.name''') + where mail_activity.res_model = 'crm.lead' GROUP BY mail_activity_type.name''') data = self._cr.dictfetchall() name = [] @@ -151,6 +151,8 @@ class CRMLead(models.Model): for rec in data2: sales.append(rec['sales']) inv_target.append(rec['invoiced_target']) + if inv_target == [None]: + inv_target = [0] team_id = rec['sale_team_id'] target_annual = (sum(sales) + sum(inv_target)) @@ -166,6 +168,8 @@ class CRMLead(models.Model): for rec in data3: sales.append(rec['sales']) inv_target.append(rec['invoiced_target']) + if inv_target == [None]: + inv_target = [0] ytd_target = (sum(sales) + sum(inv_target)) self._cr.execute('''select sum(expected_revenue) from crm_lead where stage_id=4 @@ -537,7 +541,6 @@ class CRMLead(models.Model): if len(data) != 3: del data else: - data[1] = 0 if data[2] == 0: ratio = 0 else: @@ -583,7 +586,10 @@ class CRMLead(models.Model): if len(data) != 3: del data else: - ratio = round(data[1] / data[2], 2) + if data[2] == 0: + ratio = 0 + else: + ratio = round(data[1] / data[2], 2) data.append(str(ratio)) salesperson_wise_ratio.append(data) @@ -621,7 +627,10 @@ class CRMLead(models.Model): if len(data) != 3: del data else: - ratio = round(data[1] / data[2], 2) + if data[2] == 0: + ratio = 0 + else: + ratio = round(data[1] / data[2], 2) data.append(str(ratio)) sales_team_wise_ratio.append(data) @@ -753,6 +762,8 @@ class CRMLead(models.Model): for rec in data2: sales.append(rec['sales']) inv_target.append(rec['invoiced_target']) + if inv_target == [None]: + inv_target = [0] team_id = rec['sale_team_id'] target_annual = (sum(sales) + sum(inv_target)) @@ -768,6 +779,8 @@ class CRMLead(models.Model): for rec in data3: sales.append(rec['sales']) inv_target.append(rec['invoiced_target']) + if inv_target == [None]: + inv_target = [0] ytd_target = (sum(sales) + sum(inv_target)) self._cr.execute('''select sum(expected_revenue) from crm_lead where stage_id=4