Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
2694 Weergaven

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 

Avatar
Annuleer
Beste antwoord

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.

Avatar
Annuleer
Beste antwoord

You can't do that from record rules directly.

Avatar
Annuleer
Beste antwoord

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

def function_something(self):

     if user_somone.XXX_field :

           some_code_here

Avatar
Annuleer