Skip to Content
Menu
This question has been flagged
1 Reply
17484 Views

I would like to add button into the view as in title.

There is a button box div and myButton must be placed inside of this box. 

...

<field name="" position="inside">

<button name="pick_one" class="oe_inline oe_stat_button" type="object" style="background:rgba(46, 210, 162,0.2);" string="- 1" icon="fa-sign-out" attrs="{'invisible':['|',('type', '=', 'service')]}"/>

</field>

...

How should I add it ?


Avatar
Discard
Best Answer

To add the button inside div,Please add the below code,


<xpath expr="//div[@name='buttons']" position="inside"> 

<button name="pick_one" class="oe_inline oe_stat_button" type="object" style="background:rgba(46, 210, 162,0.2);" string="- 1" icon="fa-sign-out" attrs="{'invisible':['|',('type', '=', 'service')]}"/>

</xpath>

Avatar
Discard
Author

Awesome, thank you Nilesh :) AssertionError: Did not expect element xpath there, line 9 Where should I add it in xml file ? to avoid this error ?

Author

OK, i got it :)

Author

Done :)

Author

By any chance can I decide where to put it I mean above or below existing buttons ?

Yes, you can decide where to add button. Inside means Button added after the other existing buttons. If you need to add button after/before particular existing button, then you have to use xpath like(example) <xpath expr="//div[@name='buttons']/button[@name='action_open_quants']" position="after"> You can use position after, before or inside. 'action_open_quants' is the name of the button.

Author

Got it, THANK YOU! Nilesh