コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
19263 ビュー

It's possible hide a button with context data information. I need hide the button where the context Boolean field is False

So far i have

ctx ={'some_boolean': True,}

<button name="select_partner" type="object" string="Select" class="oe_highlight" invisible="context.get('some_boolean',False)"/>

but that hide the button in the wrong place

I need something like 

<button name="select_partner" type="object" string="Select" class="oe_highlight" attrs="{'invisible':[(context.get('some_boolean'),'!=',True)]}"/>

the second code return an error on the view.

Any sugestion

アバター
破棄
最善の回答

Instead of using the context, you can make an invisible boolean field and make the domain to invisible.

like < field name="x" invisible="1"/>

<button name="select_partner" type="object"
 string="Select" class="oe_highlight"  
attrs="{'invisible':[x,'!=',True)]}"/>


アバター
破棄
最善の回答

Hi Rafael, 
Yes you can do it. 
Just add this to your button : 

<button name="select_partner" type="object" string="Select" class="oe_highlight" invisible="context.get('some_boolean',False)"/>
アバター
破棄

This not working in odoo 14

Check "view_account_analytic_line_tree_inherit_account" you will find out thats it's still used in V14.

関連投稿 返信 ビュー 活動
1
8月 23
3254
0
11月 21
2346
4
10月 21
79988
0
4月 21
5428
1
12月 19
3691