[英]Call a python method in record rule Odoo
The common syntax of record rules is ['|',('user_id','=',user.id),('user_id','=',False)]]记录规则的常用语法为['|',('user_id','=',user.id),('user_id','=',False)]]
Is there any possiblilties we can use a python method to get the dynamic ids of user?有没有可能我们可以使用 python 方法来获取用户的动态 ID?
For Example例如
['|',('user_id','=',getuserid()),('user_id','=',False)] ['|',('user_id','=',getuserid()),('user_id','=',False)]
You can try something like, xml:您可以尝试类似 xml 的方法:
['|',('user_id','=', user.env["your.model"].get_userid().id), ('user_id','=',False)]
Py:派:
def get_userid(self):
domain = []
return self.env["res.user"].search(domain)
Let me know if this works for you.如果这对你有用,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.