[PERF] crm: fix performances of activity report
RATIONALE Activity report is slow, as it makes a complex query inside mail.message table which is one of our biggest table with crm.lead table, also a big table. This activity report could be speeduped by looking only on activities, not including discussions messages. SOLUTION Rationale is that discussions can be about whatever (real discussion with customers but also internal discussion, notes, ...). What matter here is to report on activities like phonecalls, followup emails, meetings, ... to have a global view of sales people activity. SPECIFICATIONS Remove inclusion of discussion messages in the query. Keep only activities-based messages. Task-3129356 (Crm: Fix activity report performances) Part-of: odoo/odoo#112535
This commit is contained in:
@@ -70,11 +70,10 @@ class ActivityReport(models.Model):
|
||||
"""
|
||||
|
||||
def _where(self):
|
||||
disccusion_subtype = self.env.ref('mail.mt_comment')
|
||||
return """
|
||||
WHERE
|
||||
m.model = 'crm.lead' AND (m.mail_activity_type_id IS NOT NULL OR m.subtype_id = %s)
|
||||
""" % (disccusion_subtype.id,)
|
||||
m.model = 'crm.lead' AND (m.mail_activity_type_id IS NOT NULL)
|
||||
"""
|
||||
|
||||
def init(self):
|
||||
tools.drop_view_if_exists(self._cr, self._table)
|
||||
|
||||
@@ -10,7 +10,8 @@ access_res_partner_category,res.partner.category.crm.user,base.model_res_partner
|
||||
access_crm_lost_reason_manager,crm.lost.reason.manager,model_crm_lost_reason,sales_team.group_sale_manager,1,1,1,1
|
||||
access_crm_lost_reason_salesman,crm.lost.reason.salesman,model_crm_lost_reason,sales_team.group_sale_salesman,1,0,0,0
|
||||
access_crm_lost_reason_user,crm.lost.reason.user,model_crm_lost_reason,base.group_user,1,0,0,0
|
||||
access_crm_activity_report_user,crm.activity.report.user,model_crm_activity_report,base.group_user,1,0,0,0
|
||||
access_crm_activity_report_user,crm.activity.report.user,model_crm_activity_report,base.group_user,0,0,0,0
|
||||
access_crm_activity_report_salesman,crm.activity.report.salesman,model_crm_activity_report,sales_team.group_sale_salesman,1,0,0,0
|
||||
access_calendar_event_manager,calendar.event.manager,calendar.model_calendar_event,sales_team.group_sale_manager,1,1,1,1
|
||||
access_calendar_event,calendar.event,calendar.model_calendar_event,sales_team.group_sale_salesman,1,1,1,0
|
||||
access_calendar_event_type_sale_manager,calendar.event.type.manager,calendar.model_calendar_event_type,sales_team.group_sale_manager,1,1,1,0
|
||||
|
||||
|
Reference in New Issue
Block a user