I want to make this field clickable only when user_id matches current user, tried it with readonly, attrs, options, nothing worked
<field name="stage_id" widget="statusbar" attrs="{'clickable':[('user_id','=','user.id')]}"/>
This is for odoo 8, but it probably works for odoo 10.
You don't need to use quotes on user.id
. Domains are evaluated with safe_eval()
, which includes some variables such as context
(current context dict), user
(current user record), time
(python's time
module) and so on.
So you should try :
<field name="stage_id" widget="statusbar" attrs="{'clickable':[('user_id','=', user.id)]}"/>
If this still doesn't work, try to make the field readonly.