summaryrefslogtreecommitdiff
path: root/addons/crm_iap_lead_enrich/models/res_config_settings.py
blob: 4f9d559dc2656caa7393c3eb7c9432a7cbdac5d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import api, models


class ResConfigSettings(models.TransientModel):
    _inherit = "res.config.settings"

    @api.onchange('lead_enrich_auto')
    def _onchange_cron_lead_enrich(self):
        """ change the active status of the cron according to the settings"""
        if self.module_crm_iap_lead_enrich == True:
            cron = self.sudo().with_context(active_test=False).env.ref('crm_iap_lead_enrich.ir_cron_lead_enrichment')
            if cron:
                cron.active = self.lead_enrich_auto != 'manual'