Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从 self._uid 获取登录用户的 ID。但是当我以用户身份登录时,我得到了 user_id = 1 (这是管理员帐户的 user_id)
那是我的路线。难道我做错了什么?
user_id = self._uid
替换你的代码
从
至
user_id = self.env.user
这些将为我们提供当前登录的用户作为记录集。所以,如果你需要id,得到它喜欢self.env.user.id
id
self.env.user.id