تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
2687 أدوات العرض

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

الصورة الرمزية
إهمال