From ec4d77d0a94a333e92c66647136726b728ec4e03 Mon Sep 17 00:00:00 2001 From: RisvanaCybro Date: Wed, 15 May 2024 16:27:33 +0530 Subject: [PATCH] May 15: [FIX] Bug Fixed 'crm_dashboard' --- crm_dashboard/__manifest__.py | 2 +- crm_dashboard/doc/RELEASE_NOTES.md | 2 +- crm_dashboard/models/crm_lead.py | 15 +++++++++------ crm_dashboard/static/src/js/crm_dashboard.js | 1 - 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/crm_dashboard/__manifest__.py b/crm_dashboard/__manifest__.py index 6ad0f17d3..d50d8daba 100644 --- a/crm_dashboard/__manifest__.py +++ b/crm_dashboard/__manifest__.py @@ -21,7 +21,7 @@ ################################################################################ { 'name': "CRM Dashboard", - 'version': '17.0.1.0.0', + 'version': '17.0.1.0.1', 'category': 'Extra Tools', 'summary': """Get a visual report of CRM through a Dashboard in CRM """, 'description': """CRM dashboard module brings a multipurpose graphical diff --git a/crm_dashboard/doc/RELEASE_NOTES.md b/crm_dashboard/doc/RELEASE_NOTES.md index 9ad6d8980..6a28830f1 100644 --- a/crm_dashboard/doc/RELEASE_NOTES.md +++ b/crm_dashboard/doc/RELEASE_NOTES.md @@ -1,6 +1,6 @@ ## Module -#### 28.12.2023 +#### 15.05.2024 #### Version 17.0.1.0.0 #### ADD - Initial commit for CRM Dashboard diff --git a/crm_dashboard/models/crm_lead.py b/crm_dashboard/models/crm_lead.py index 8b9d6c1de..9747a955a 100644 --- a/crm_dashboard/models/crm_lead.py +++ b/crm_dashboard/models/crm_lead.py @@ -372,11 +372,14 @@ class CRMLead(models.Model): group by extract(month from create_date) order by extract( month from create_date);''' % month_string) data = self._cr.dictfetchall() + print("data", data) for rec in data: - datetime_object = datetime.strptime( - str(int(rec['date_part'])), "%m") - month_name = datetime_object.strftime("%B") - month_dict[month_name] = rec['count'] + print("RECCCCCCC", rec) + if rec.get("date_part"): + datetime_object = datetime.strptime( + str(int(rec['date_part'])), "%m") + month_name = datetime_object.strftime("%B") + month_dict[month_name] = rec['count'] test = {'month': list(month_dict.keys()), 'count': list(month_dict.values())} return test @@ -398,7 +401,8 @@ class CRMLead(models.Model): ORDER BY COUNT(country_id) DESC''') data_lost = self._cr.fetchall() country_wise_ratio = [[won[0], won[1], str(round(won[1] / next( - (lost[1] for lost in data_lost if lost[0] == won[0]), 1), + (lost[1] for lost in data_lost if + lost[0] == won[0] and lost[0] != 0 and won[1] != 0), 1), 2))] for won in data_won[:5]] return {'country_wise_ratio': country_wise_ratio} @@ -506,7 +510,6 @@ class CRMLead(models.Model): [('user_id', '=', False), ('type', '=', 'lead')]) return {'count_unassigned': count_unassigned} - @api.model @api.model def get_top_sp_by_invoice(self, kwargs): """Top 10 Sales Person by Invoice Table""" diff --git a/crm_dashboard/static/src/js/crm_dashboard.js b/crm_dashboard/static/src/js/crm_dashboard.js index e34283978..0dd8d17b2 100644 --- a/crm_dashboard/static/src/js/crm_dashboard.js +++ b/crm_dashboard/static/src/js/crm_dashboard.js @@ -819,7 +819,6 @@ export class CRMDashboard extends Component { render_lost_leads_graph() { var self = this; var ctx = $(".lost_leads_graph"); - console.log(ctx) jsonrpc('/web/dataset/call_kw/crm.lead/get_lost_lead_by_reason_pie', { model: "crm.lead", method: "get_lost_lead_by_reason_pie",