0

I want to display the fields as editable in tree view inside a new tab in the sale.order? My code does not make any errors, but shows the fields in form view rather than tree view. How to correct it? .xml

<record model="ir.ui.view" id="contract_custom">
        <field name="name">sale.order.custom.form.inherited</field>
        <field name="model">sale.order</field>
        <field name="type">tree</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="//page[@string='Other Information']" position="after">
                    <page string="Salesman Commission">
                        <tree editable="bottom">
                                <group>
                                    <field name="user_select"/>
                                    <field name="sales_value" on_change="on_change_commission(sales_value,sale_percent)"/>
                                    <field name="sale_percent" on_change="on_change_commission(sales_value,sale_percent)"/>
                                    <field name="sale_commission"/>
                                </group>
                        </tree>
                    </page>
                </xpath>
            </field>
    </record>
DGL
  • 53
  • 9

1 Answers1

1

Here is a possible solution

<record model="ir.ui.view" id="contract_custom">
        <field name="name">sale.order.custom.form.inherited</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="//page[@string='Other Information']" position="after">
                    <page string="Salesman Commission">
                     <field name="field_name"> <!-- field you want to show as tree -->
                        <tree editable="bottom">
                           <field name="user_select"/>
                           <field name="sales_value" on_change="on_change_commission(sales_value,sale_percent)"/>
                           <field name="sale_percent" on_change="on_change_commission(sales_value,sale_percent)"/>
                           <field name="sale_commission"/>
                        </tree>
                      </field>
                    </page>
                </xpath>
            </field>
</record>
Sorginah
  • 112
  • 11
  • But I want all the fields in the tags to come in the list view. From there I should be able to edit the field values. Just like the sale_order_line where we can click on 'add an item' and enter a new item. Any ideas. – DGL Jan 08 '18 at 11:53
  • You have to replace the "field_name" with a one2many or many2many and between tree tags add the fields you want to show. The same as order_line field. – Sorginah Jan 08 '18 at 12:12