Files
odoo_source/addons/hr_presence/__init__.py
T
Kevin Baptiste af357fecd6 [IMP] hr: enforce selection of one advanced control option
Before this commit, it was possible to activate the Advanced Presence
Control feature without any advanced feature enabled.

This commit enforces the selection of *at least* one of those option
(email or IP).

closes odoo/odoo#60498

Taskid: 2361870
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-11-12 09:17:57 +00:00

18 lines
571 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import controllers
from . import models
from odoo import api, SUPERUSER_ID
def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
email = env['ir.config_parameter'].get_param('hr_presence.hr_presence_control_email')
ip = env['ir.config_parameter'].get_param('hr_presence.hr_presence_control_ip')
if not email and not ip:
env['ir.config_parameter'].sudo().set_param('hr_presence.hr_presence_control_email', True)