Hello Himanshu,
Here you need to use the concept of one2many field type of your custom model i.e demo.demo in sale_order
demo_demo.py
---------------------------------------
class DemoDemo(models.Model):
_name = 'demo.demo'
field1 =
field2 =
field3 =
sale_order_id = fields.One2many('sale.order', string="Sale Order")
sale_order.py
---------------------------------------
class SaleOrder(models.Model):
_inherit = 'sale.order'
demo_ids = fields.One2many('demo.demo', sale_order_id, string="Demo")
From xml side you need to inherit the sale_order form view i.e "view_order_form"
sale_order_view.xml
--------------------------------
<record id="view_order_form" 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/sheet/notebook" position="inside">
<page string="Demo Lines">
<field name="demo_ids">
<tree string="Demo Lines" editable="bottom">
<field name="field1"/>
<field name="field2"/>
<field name="field3"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
For detailed information regarding field type in odoo, you may refer this link https://www.cybrosys.com/blog/fields-and-parameters-in-odoo
And for inherit view -> http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html
Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari