[UPD] otp_sms_auth_custom

This commit is contained in:
Samir Ladoui 2025-09-17 11:30:44 +01:00
parent 70953d7087
commit 9a2f6fd856
1 changed files with 5 additions and 1 deletions

View File

@ -14,9 +14,13 @@ class AuthSignInHome(Home):
if not kw.get('otp_mobile_phone'):
data['msg'] = 'No mobile phone number provided for OTP!'
else:
# Get the target boolean field name for the account_type
target_field = request.env['res.partner'].sudo().get_partner_target_account_type(kw.get('account_type'))
user = request.env['res.users'].sudo().search([
('login', '=', kw.get('otp_mobile_phone')),
('partner_id.account_type', '=', kw.get('account_type'))
# ('partner_id.account_type', '=', kw.get('account_type'))
('partner_id.%s' % target_field, '=', True)
], limit=1)
if user:
data['status'] = True