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

I would like to know if it is possible to specify the order of smart buttons on form views. If we use xpath position = inside for any buttons added in custom modules they all seem to appear before (or to the left of) the standard Odoo smart buttons (sales, invoices, vendor bills, etc). To use xpath position=after we have to inherit sale or purchase module which seems like a hack. Is there a better way? I'm using Odoo version 10 Enterprise.

Avatar
Zrušit
Nejlepší odpověď

Hi Garth Mathers,

From your question, what I can understand is, this is the problem in your xpath expression.

If you are given the xpath correctly, then the button will appear where ever you want.

I will give two examples of giving buttons in two different positions in the partner form.

check the code. and correct your code.

1) Position after the name="toggle_active" button.

<record model="ir.ui.view" id="new_id_for_the_form">
<field
name="name">new_name_for_the_form</field>
<field name="model">res.partner</field>
<field
name="inherit_id" ref="base.view_partner_form"/>
<field
name="arch" type="xml">
<xpath
expr="/form/sheet/div[@name='button_box']/button[@name='toggle_active']" position="after">
<button
name="toggle_active_copy" type="object" class="oe_stat_button" icon="fa-archive">
<field
name="active" widget="boolean_button" options="{&quot;terminology&quot;: &quot;archive&quot;}"/>
</button>
</xpath>
</field>
</record>

2) Position after the id="invoice_button".  (Note: This is an inherited view. so xpath and inherit_id will be changed)

<record model="ir.ui.view" id="second_id_for_the_form">
<field name="name">second_name_for_the_form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account.partner_view_buttons"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']/button[@id='invoice_button']" position="after">
<button name="toggle_active_copy" type="object" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options="{&quot;terminology&quot;: &quot;archive&quot;}"/>
</button>
</xpath>
</field>
</record>


Thank you.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
4
zář 21
15833
0
čvc 21
3341
0
bře 17
3971
1
čvn 22
6058
2
úno 20
9883