Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
17972 มุมมอง

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 ?


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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>

อวตาร
ละทิ้ง
ผู้เขียน

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 ?

ผู้เขียน

OK, i got it :)

ผู้เขียน

Done :)

ผู้เขียน

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.

ผู้เขียน

Got it, THANK YOU! Nilesh