From 774ac2daffd97c46f7dfb84b45bf0175a1053a71 Mon Sep 17 00:00:00 2001 From: Denis Vermylen Date: Fri, 10 Feb 2017 15:50:38 +0100 Subject: [PATCH] [FIX] sales_team: handle period=week, groupby=month for graphs in the sales dashboard. --- addons/sales_team/models/crm_team.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/sales_team/models/crm_team.py b/addons/sales_team/models/crm_team.py index 95f451086fd..a05520d422b 100644 --- a/addons/sales_team/models/crm_team.py +++ b/addons/sales_team/models/crm_team.py @@ -92,6 +92,9 @@ class CrmTeam(models.Model): # (to avoid having twice the same month/week/day from different years/month/week) if self.dashboard_graph_group == 'month': start_date = date(start_date.year + start_date.month / 12, start_date.month % 12 + 1, 1) + # handle period=week, grouping=month for silly managers + if self.dashboard_graph_period == 'week': + start_date = today.replace(day=1) elif self.dashboard_graph_group == 'week': start_date += relativedelta(days=8 - start_date.isocalendar()[2]) # add a week to make sure no overlapping is possible in case of year period (will display max 52 weeks, avoid case of 53 weeks in a year)