From cd1ddc7cadf352010d83239d6d85fa1c334ad12f Mon Sep 17 00:00:00 2001 From: "Antoine (ande)" Date: Thu, 12 Oct 2023 17:15:09 +0200 Subject: [PATCH] [FIX] auth_totp_mail_enforce: cannot save option Current behaviour: When checking "All users" then saving, it unchecks it then checks "Employees only" Steps to reproduce: 1. Install auth_totp_mail_enforce 2. Go to Settings 3. Check "Two-factor authentication enforcing policy" 4. Hit Save 5. ("Employees only" is selected) 6. Select "All users" 7. Hit Save 8. ("Employees only" is still selected) Cause of the issue: Because of onchange, _onchange_auth_totp_enforce is called when refreshing the page, which causes auth_totp_policy to default as 'employee_required' opw-3523880 closes odoo/odoo#139535 X-original-commit: 1d8423e397e7646eec9eebab8a1fd40e39605404 Signed-off-by: Nicolas Lempereur (nle) Signed-off-by: Antoine Demany (ande) --- addons/auth_totp_mail_enforce/models/res_config_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/auth_totp_mail_enforce/models/res_config_settings.py b/addons/auth_totp_mail_enforce/models/res_config_settings.py index 7a84bf99b72..90b2b8aed37 100644 --- a/addons/auth_totp_mail_enforce/models/res_config_settings.py +++ b/addons/auth_totp_mail_enforce/models/res_config_settings.py @@ -21,7 +21,7 @@ class ResConfigSettings(models.TransientModel): @api.onchange('auth_totp_enforce') def _onchange_auth_totp_enforce(self): if self.auth_totp_enforce: - self.auth_totp_policy = 'employee_required' + self.auth_totp_policy = self.auth_totp_policy or 'employee_required' else: self.auth_totp_policy = False