[FIX] crm: A closed lead doesn't mean there is nothing more to do
Before this commit, because of9d2f48dandabea8d3and4ebb5efac4closed 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
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -384,7 +384,7 @@
|
||||
domain="[('activity_ids.user_id', '=', uid)]"/>
|
||||
<separator/>
|
||||
<filter string="Late Activities" name="activities_overdue"
|
||||
domain="[('activity_ids.date_deadline', '<', context_today().strftime('%Y-%m-%d')), ('date_closed', '=', False)]"
|
||||
domain="[('activity_ids.date_deadline', '<', context_today().strftime('%Y-%m-%d'))]"
|
||||
help="Show all records which has next action date is before today"/>
|
||||
<filter string="Today Activities" name="activities_today"
|
||||
domain="[('activity_ids.date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
|
||||
@@ -629,7 +629,7 @@
|
||||
domain="[('activity_ids.user_id', '=', uid)]"/>
|
||||
<separator/>
|
||||
<filter string="Late Activities" name="activities_overdue"
|
||||
domain="[('activity_ids.date_deadline', '<', context_today().strftime('%Y-%m-%d')), ('date_closed', '=', False)]"
|
||||
domain="[('activity_ids.date_deadline', '<', context_today().strftime('%Y-%m-%d'))]"
|
||||
help="Show all opportunities for which the next action date is before today"/>
|
||||
<filter string="Today Activities" name="activities_today"
|
||||
domain="[('activity_ids.date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
|
||||
@@ -732,6 +732,34 @@ if record:
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
'Mark Late Activities as Done' in action dropdown
|
||||
-->
|
||||
<record id="action_mark_late_activities_done" model="ir.actions.server">
|
||||
<field name="name">Mark Late Activities as Done</field>
|
||||
<field name="model_id" ref="model_crm_lead"/>
|
||||
<field name="binding_model_id" ref="crm.model_crm_lead"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
for rec in records:
|
||||
rec.activity_ids.filtered(lambda a: a.state == 'overdue').action_feedback(feedback='Closed automatically in batch')
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
'Mark All Activities as Done' in action dropdown
|
||||
-->
|
||||
<record id="action_mark_activities_done" model="ir.actions.server">
|
||||
<field name="name">Mark All Activities as Done</field>
|
||||
<field name="model_id" ref="model_crm_lead"/>
|
||||
<field name="binding_model_id" ref="crm.model_crm_lead"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
for rec in records:
|
||||
rec.activity_ids.action_feedback(feedback='Closed automatically in batch')
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Menu Actions
|
||||
-->
|
||||
|
||||
Reference in New Issue
Block a user