Skip to content

Commit

Permalink
[IMP] crm_iap_enrich: add a param for the enrich leads cron
Browse files Browse the repository at this point in the history
Add a method parameter for the delay applied for the create date
on the _iap_enrich_leads_cron.

task-3514687
  • Loading branch information
jeh-odoo committed May 15, 2024
1 parent 3813839 commit 2a47480
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions addons/crm_iap_enrich/models/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def _compute_show_enrich_button(self):
lead.show_enrich_button = True

@api.model
def _iap_enrich_leads_cron(self):
timeDelta = fields.datetime.now() - datetime.timedelta(hours=1)
def _iap_enrich_leads_cron(self, enrich_hours_delay=1, leads_batch_size=1000):
timeDelta = self.env.cr.now() - datetime.timedelta(hours=enrich_hours_delay)
# Get all leads not lost nor won (lost: active = False)
leads = self.search([
('iap_enrich_done', '=', False),
('reveal_id', '=', False),
'|', ('probability', '<', 100), ('probability', '=', False),
('create_date', '>', timeDelta)
])
], limit=leads_batch_size)
leads.iap_enrich(from_cron=True)

@api.model_create_multi
Expand Down

0 comments on commit 2a47480

Please sign in to comment.