This question has been flagged
2 Replies
5014 Views

Create “Related Purchase Orders” Tab in the Sales Order to the right of “Other Information” tab in my module.

<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="//page[@string='Other Information']" position="after">
<page string= "Related Purchase Orders">
</page>
</xpath>
</field>

In my module, In the top page of the SO form view, create two char fields, named “Project” and “Contract

NO.” Show these two fields also in the SO list view. and Create a char field in the PO form view named “Contract NO.”.

In the form view of PO, add a many2one field named “Related Sales Order”, which

contains the sale.order object. Make this field a required field, show this field also in the

list view of the PO. When choosing the “Related Sales Order” in PO, automatically pass

the “Contract NO.” from SO to PO.

last i create a new tab "Related Purchase Orders".

now i want, In the tab, show a tree structure of all the POs that are related to the SO by the

many2one “Sales Order” field in the PO.?

Please Help me 
Thank you in advance.

Avatar
Discard
Best Answer

In XML

<xpath expr="//page[@string='Other Information']" position="after">
<page string= "Related Purchase Orders">
<tree string="rpo">
<field name="rpo"/>
 </tree>
</page>
IN Python

rpo = fields.One2many('purchase.order', 'rso', ondelete='cascade'.


rso: is the 
rso = fields.Many2one('sale.order', ' Related Sales Order', required=True, ondelet='cascade')
TRY THIS..
Avatar
Discard
Author

Thanks

Author Best Answer

thank you very much. its working..

Avatar
Discard