From 51342d0d2d0318ffc985a1a75fb4d386e62f1d3d Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Wed, 27 Jul 2022 11:59:45 +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 | 14 ++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/crm_dashboard/__manifest__.py b/crm_dashboard/__manifest__.py index 936378184..1c07a5946 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, odoo13""", 'summary': """Detailed Dashboard View for CRM""", 'category': 'Sales', - 'version': '13.0.1.0.2', + 'version': '13.0.1.0.3', '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 c2b8e5f66..2f660eb4f 100644 --- a/crm_dashboard/doc/RELEASE_NOTES.md +++ b/crm_dashboard/doc/RELEASE_NOTES.md @@ -3,4 +3,9 @@ #### 18.12.2021 #### Version 13.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 13.0.1.0.3 +#### 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 535755db6..90a69c2cc 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 = [] @@ -376,7 +376,7 @@ class CRMLead(models.Model): self.achievement_amount = achievement percent = 0 - if total != 0: + if total > 0: percent = (achievement * 100 / total) / 100 goals.append(achievement) @@ -586,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) @@ -624,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)