Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
19265 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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


Avatar
Zrušit
Nejlepší odpověď

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)"/>
Avatar
Zrušit

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.

Related Posts Odpovědi Zobrazení Aktivita
1
srp 23
3255
0
lis 21
2349
4
říj 21
79990
0
dub 21
5429
1
pro 19
3691