Skip to Content
Menu
This question has been flagged

Hey i have duplicated purchase order module and now i am adding field only to that duplicated view. I am able to add fields in the header part but when i try to add field in the line view it gives error like

'field partner does not exist'

Can you tell how i am suppose to do that

class PurchaseInvestment(models.Model):
_name = 'purchase.investment'
_inherit = 'purchase.order'

partner = fields.Many2one('res.partner', string='Investor')

This is my py file and here is my xml
<record model="ir.ui.view" id="tata_mod_pr_investment">
<field name="name">Purchase Order Investment</field>
<field name="model">purchase.investment</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page[1]/field/tree" position="inside">
<field name="partner"/>
</xpath>

</field>
</record>
Avatar
Discard
Best Answer

probably you might need to update the module. When you do that, you will find that your form is not correct because you are adding a field "partner" to the purchase order. Try using  <field name="mode">primary</field> after  <field name="inherit_id".

Also, I suggest you look at the code, there are lot's of nice examples there

Avatar
Discard
Author

Hey Thanks for replying ,What would this mode field do? not working in my case though

using xml inherit_id will only change existing form, to create a new one we use that mode. On a new object maybe you just should create the form from scratch or copy paste the purchase order and change

Related Posts Replies Views Activity
2
Dec 22
4478
2
Aug 23
1837
3
Apr 23
1031
3
Dec 22
31940
1
Mar 15
3936