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

Good day Everyone,

I have this code but does not work, I've searched samples on web without any luck. Could anyone please point the proper way to add a button to the sale order form.

Apologize the editor does not allow me to proper format the xml or paste the sample code
Thanks in advance


        ## ADD BUTTOM SALE ORDER VIEW



        <record id="sale_order_view_form_ih" model="ir.ui.view">



          <field name="name">TEST SALE BUTTON</field>



          <field name="model">sale.order</field>



          <field name="inherit_id" ref="sale.view_order_form"/>



          <field name="arch" type="xml">



             <xpath expr="//form//header//button[@name='action_quotation_send']" position="after">



                <button name="test" string="Test" type="object"/>



            </xpath>



          </field>



        </record>



อวตาร
ละทิ้ง

<record id="view_order_form_ddbutton" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//form//header//button[@name='action_draft']" position="after">
<button name="action_unlock" type="object" string="Unlock" states="done" groups="sales_team.group_sale_manager"/>
</xpath>
</field>
</record>

ผู้เขียน

thanks CorTex IT Solutions Ltd. I tried your code and neither add the button. I'm not sure why I'm unable to post code here in the editor. it seems is not find the proper record or class.

can you ensure that your inherited view is loaded into the db ?

คำตอบที่ดีที่สุด

Hi

XML:

<record id="view_order_form" model="ir.ui.view">
 
          <field   name="name">sale.order.view.form.inherit.module.name</field>
 
          <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
               <xpath expr="//header" position="inside">
                //you can add your own paths here and if you need to add attrs you can add attrs in the button
                    <button type="object" name="action_test" string="Button Test"/>
                </xpath>
            </field>
    </record>


Python file :
def action_test(self):
//you can add the button click functions here

Hope it helps

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 24
583
1
ม.ค. 24
13573
Sale Order Line Form Popup Odoo 14 แก้ไขแล้ว
1
ก.พ. 22
4011
Option Duplicate in DropDown More แก้ไขแล้ว
2
พ.ค. 19
3048
3
ส.ค. 18
4333