Eimis Genčiauskas
Eimis Genčiauskas

Reputation: 85

Odoo v10 how to make statusbar clickable on condition?

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')]}"/>

Upvotes: 0

Views: 3116

Answers (2)

Unatiel
Unatiel

Reputation: 1080

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.

Upvotes: 2

user8019577
user8019577

Reputation:

Try out:

<field name="stage_id" widget="statusbar" attrs="{'clickable':[('user_id','=','uid')]}"/>

Upvotes: 0

Related Questions