Files
odoo_source/addons/crm_iap_lead_enrich/__init__.py
T
Martin Trigaux 09fa76afff [FIX] *: do not import tests folder
The tests must be only imported in a test context, not in a running
context.
Since 92a7f8c13f a new test requirement was added but it should
not be necessary to run a module, only to execute the tests.

closes odoo/odoo#54578

X-original-commit: 15f2bbd40a70d9d9e969a2c75b7b9131c100dc09
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-07-16 12:55:00 +00:00

15 lines
487 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
from odoo.api import Environment, SUPERUSER_ID
def _synchronize_cron(cr, registry):
env = Environment(cr, SUPERUSER_ID, {'active_test': False})
cron = env.ref('crm_iap_lead_enrich.ir_cron_lead_enrichment')
if cron:
config = env['ir.config_parameter'].get_param('crm.iap.lead.enrich.setting', 'manual')
cron.active = config != 'manual'