From 6216e6e25bed1b00fcf3a88a72832595fc8a8335 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 19 Dec 2017 17:24:17 +0100 Subject: [PATCH] [FIX] crm: A closed lead doesn't mean there is nothing more to do Before this commit, because of 9d2f48d and abea8d3 and 4ebb5efac44fd4fe9066c32c533b9130e6e2e242 closed crm.lead with late activities wouldn't show. Aware that this is essentially a choice of non-crucial behavior, there are some precautionary arguments. - The three commits above make the choice of having a "clean" backlog: late activities are not polluted by crm leads that are already won - The choice of this commit is to count activities as late regardless of the state of the lead: The use case: Close a deal with a partner > lead is won and closed But it doesn't mean you don't have to call the partner back in a few days to actually sign a paper, organize some sort of meeting The argument: it is better to not miss deadlines eventhough they might accumulate, rather than forgetting about them altogether (but you don't script something to put all your emails as read when they arrive, do you ?) OPW 744940 --- addons/crm/models/crm_lead.py | 2 +- addons/crm/views/crm_lead_views.xml | 32 +++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 627d480f242..07afb0c079f 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -988,7 +988,7 @@ class Lead(models.Model): result['activity']['today'] += 1 if date.today() <= date_deadline <= date.today() + timedelta(days=7): result['activity']['next_7_days'] += 1 - if date_deadline < date.today() and not opp.date_closed: + if date_deadline < date.today(): result['activity']['overdue'] += 1 # Won in Opportunities if opp.date_closed and opp.stage_id.probability == 100: diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index 485d644a049..6e6b89cb901 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -384,7 +384,7 @@ domain="[('activity_ids.user_id', '=', uid)]"/> @@ -629,7 +629,7 @@ domain="[('activity_ids.user_id', '=', uid)]"/> @@ -732,6 +732,34 @@ if record: + + + Mark Late Activities as Done + + + code + +for rec in records: + rec.activity_ids.filtered(lambda a: a.state == 'overdue').action_feedback(feedback='Closed automatically in batch') + + + + + + Mark All Activities as Done + + + code + +for rec in records: + rec.activity_ids.action_feedback(feedback='Closed automatically in batch') + + +