Skip to content
Snippets Groups Projects
Commit 2be5cd95 authored by Nshimiyimana Séna's avatar Nshimiyimana Séna
Browse files

[FIX] crm_iap_enrich: correctly save 'Enrich lead automatically' setting


## Steps to reproduce
1. navigate to Settings -> CRM -> Lead Enrichment section
2. change the Lead Enrichment option to "Enrich leads on demand only"
3. click Save button
4. wait for system to save and refresh.

You should see that the change you made was not saved.

opw-3063639

closes odoo/odoo#106851

X-original-commit: 0803775e4a156aa6988453edbbaf799730c996b2
Signed-off-by: default avatarWarnon Aurélien (awa) <awa@odoo.com>
parent c2b8faa1
Branches
Tags
No related merge requests found
......@@ -17,5 +17,5 @@ class ResConfigSettings(models.TransientModel):
def set_values(self):
super().set_values()
cron = self.sudo().with_context(active_test=False).env.ref('crm_iap_enrich.ir_cron_lead_enrichment', raise_if_not_found=False)
if cron and cron.active != self.lead_enrich_auto == 'auto':
if cron and cron.active != (self.lead_enrich_auto == 'auto'):
cron.active = self.lead_enrich_auto == 'auto'
......@@ -56,3 +56,16 @@ class TestLeadEnrich(TestCrmCommon, MockIAPEnrich):
for lead in leads:
self.assertEqual(lead.street, False)
def test_lead_enrich_auto_setting(self):
cron = self.env.ref('crm_iap_enrich.ir_cron_lead_enrichment')
config = self.env['res.config.settings'].create({
'lead_enrich_auto': 'manual',
})
config.execute()
self.assertFalse(cron.active)
config.write({'lead_enrich_auto': 'auto'})
config.execute()
self.assertTrue(cron.active)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment