跳至內容
選單
此問題已被標幟
3 回覆
2688 瀏覽次數

hello,

 i want to write rule access but before i check domain i must check if XXX_field is exist in res.user or not 

how can i do this 

頭像
捨棄
最佳答案

Hi,

You can check if a field exist in a model using the below code:

if 'XXX_field' in self.env['res.users']._fields:
     ...
    Your code

Regards.

頭像
捨棄
最佳答案

You can't do that from record rules directly.

頭像
捨棄
最佳答案

user_someone = fields.Many2one('res.users')

def function_something(self):

     if user_somone.XXX_field :

           some_code_here

頭像
捨棄