콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
7076 화면

Hello All,

I am working on Odoo12. when I log in for odoo then it redirects me on the same login page and all login options available for me. So, the problem is related to redirect. I have tested the code and got that request.params['login_success'] show 'false' value in print. My python code is below.

    @http.route(website=True, auth="public")
def web_login(self, redirect=None, *args, **kw):
response = super(CustomAuthSignupHome, self).web_login(redirect=redirect, *args, **kw)
print('Loginnn', request.params['login_success'])
if not redirect and request.params['login_success']:
user = request.env['res.users'].browse(request.uid)
if user.has_group('base.group_user'):
if user.partner_id.company_type == 'company':
redirect = '/dashboard'
else:
redirect = b'/web?' + request.httprequest.query_string
return http.redirect_with_hash(redirect)
return response

So, anyone can suggest the solution for this problem. 

Thanks in advance.

아바타
취소
작성자 베스트 답변

Problem solved. missed else condition for redirection


@http.route(website=True, auth="public")
def web_login(self, redirect=None, *args, **kw):
response = super(CustomAuthSignupHome, self).web_login(redirect=redirect, *args, **kw)
if not redirect and request.params['login_success']:
user = request.env['res.users'].browse(request.uid)
if user.has_group('base.group_user'):
if user.partner_id.company_type == 'company':
redirect = '/dashboard'
else:
redirect = b'/web?' + request.httprequest.query_string
else:
redirect = '/my/account'
return http.redirect_with_hash(redirect)
return response


아바타
취소
관련 게시물 답글 화면 활동
3
1월 24
12453
3
11월 23
17563
3
11월 24
25248
1
4월 23
6241
2
12월 22
7003