Search code examples
odooodoo-8

how to make display like sales order lines in odoo


I am a newbie in odoo development, can someone tell me how to make display like in picture sales order line in odoo, Thank you before


Solution

  • This is One2many field in Odoo to made one like this you have to add some things like this:

    In python code

    from openerp import fields,models
    class sale_order(models.Model):
         _inherit='sale.order'
         field_One2many=field.One2many('sale.order.line','order_id','Order')
    sale_order()
    class sale_order_line(models.model):
         _inherit='sale.order.line'
         order_id=fields.Many2one('sale.order','Order')
    sale_order_line()
    

    and you have some code for the view in your Xml file like:

    <record model="ir.ui.view" id="view_test">
                <field name="name">sale.order.form</field>
                <field name="model">sale.order</field>
                <field name="inherit_id" ref="sale_order.form_view_id"/>
                <field name="arch" type="xml">
                    <data>
                        <xpath expr="pass of position" position="the postion">
                            <field name='field_One2many'>
                              <tree>
                                 <!-- Your Fields in the view -->
                              </tree>
                          </field>
                        </xpath>
                    </data>
                </field>
            </record>
    

    and done