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.
我有一张桌子orders,这orders是由 juan 制作的,juan 分配给 pedro。当 Pedro logg 时,我只想列出 pedro 的订单。我怎样才能过滤这个?
orders
我如何知道谁是登录的活动用户?
在哪个对象中,我可以找到它吗?
您应该使用记录规则并为 sale.order 模型添加以下规则
[('create_uid', '=', user.id)]
用户对象保留有关当前登录用户的信息。
尝试这个
users = self.pool.get('res.users') current_user = users.browse(cr, uid, uid, context=context)
current_user 是当前用户的 res.users 对象