From 9765b6908c2d30dc5c4aca47c014faee4550bf1e Mon Sep 17 00:00:00 2001 From: Andrii9090-tecnativa Date: Mon, 7 Sep 2026 11:33:46 +0200 Subject: [PATCH] [FIX] password_security: Bypass password security checks for other modules tests --- password_security/models/res_users.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/password_security/models/res_users.py b/password_security/models/res_users.py index 0d3d9fc62f..5dee8fbc2a 100644 --- a/password_security/models/res_users.py +++ b/password_security/models/res_users.py @@ -6,8 +6,9 @@ import re from datetime import datetime, timedelta -from odoo import _, api, fields, models +from odoo import _, api, fields, models, modules from odoo.exceptions import UserError, ValidationError +from odoo.tools import config def delta_now(**kwargs): @@ -68,6 +69,11 @@ def get_password_policy(self): return data def _check_password_policy(self, passwords): + if ( + config["test_enable"] + and not modules.module.current_test.test_module == "password_security" + ): + return True result = super()._check_password_policy(passwords) for password in passwords: @@ -114,7 +120,10 @@ def _check_password(self, password): def _check_password_rules(self, password): self.ensure_one() - if not password: + if not password or ( + config["test_enable"] + and not modules.module.current_test.test_module == "password_security" + ): return True pwd_params = self._get_all_password_params() password_regex = [