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

I want to identify certain machines so that no matter which user is logged in some rules will apply to them. Is it possible?

아바타
취소
베스트 답변

Hi,

You can get the logged in machine details using the following code.

import httpagentparser

agent = request.httprequest.environ.get('HTTP_USER_AGENT')
agent_details = httpagentparser.detect(agent)
user_os = agent_details['os']['name']
browser_name = agent_details['browser']['name']
ip_address = request.httprequest.environ['REMOTE_ADDR']

From the above code you will get the IP address of the logged system, Browser and OS details.

You can also check with this community modules, but it is not in v7.

https://www.odoo.com/apps/modules/10.0/login_user_detail/

https://www.odoo.com/apps/modules/10.0/user_login_alert/

Thanks

아바타
취소
작성자

How do I get the request object?

above code is return inside the controller. You can check the modules in the given link, that will give you more info

베스트 답변

User login alert gives error as "Unable to install module "user_login_alert" because an external dependency is not met: No module named httpagentparser" Please assist.

아바타
취소

`pip install httpagentparser` should solve your issue

관련 게시물 답글 화면 활동
2
3월 24
11795
2
8월 21
13917
1
12월 19
5655
0
9월 17
3905
0
8월 17
3149