mirror of
https://github.com/bringout/oca-ocb-crm.git
synced 2026-04-21 22:32:04 +02:00
19.0 vanilla
This commit is contained in:
parent
dc68f80d3f
commit
7221b9ac46
610 changed files with 135477 additions and 161677 deletions
|
|
@ -11,12 +11,9 @@ class ChatbotScript(models.Model):
|
|||
string='Generated Lead Count', compute='_compute_lead_count')
|
||||
|
||||
def _compute_lead_count(self):
|
||||
mapped_leads = {}
|
||||
if self.ids:
|
||||
leads_data = self.env['crm.lead'].with_context(active_test=False).sudo()._read_group(
|
||||
[('source_id', 'in', self.mapped('source_id').ids)], ['source_id'], ['source_id'])
|
||||
mapped_leads = {lead['source_id'][0]: lead['source_id_count'] for lead in leads_data}
|
||||
|
||||
leads_data = self.env['crm.lead'].with_context(active_test=False).sudo()._read_group(
|
||||
[('source_id', 'in', self.mapped('source_id').ids)], ['source_id'], ['__count'])
|
||||
mapped_leads = {source.id: count for source, count in leads_data}
|
||||
for script in self:
|
||||
script.lead_count = mapped_leads.get(script.source_id.id, 0)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue