Change the Position of field in Xpath

313 Views Asked by At

i want to change the position of Button Refuse10 have to take the place of send for payement illustration

this is the natif code

<record id="view_expenses_form" model="ir.ui.view">
<field name="name">hr.expense.form</field>
<field name="model">hr.expense.expense</field>
<field eval="25" name="priority"/>
<field name="arch" type="xml">
<form string="Expenses Sheet">
<header>
   <button name="confirm" states="draft" string="Submit to Manager" type="workflow" class="oe_highlight"/>
   <button name="validate" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
   <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
   <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
   <button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice" class="oe_highlight"/>
   <button name="action_view_move" states="done" string="Open Accounting Entries" type="object" groups="account.group_account_invoice"/>
   <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done,paid" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
</header>
1

There are 1 best solutions below

1
Shahid Raza On

According to your question, first, you need to hide Refuse10 button and put the same button after send for payment

Note: Use inherit view and position with xpath.

<xpath expr="//button[@name='Refuse10 button name']" position="attributes">
   <attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//button[@name='send for payment']" position="after">
   <button name="Refuse10" string="Refuse10"/>
</xpath>