0
votes

I have a test many2one field. When it is populated I want the partner_id field to use the partner associated with that field. Following is not working:

<field name="partner_id" required="1"/>
<field name="x_test" context="{'partner_id': parent.partner_id}" />
2
Is the code in a wizard?Hilar AK

2 Answers

0
votes

you should try this :

<field name="x_test" context="{'default_partner_id': partner_id}" />

I don't know what you mean by parent.partner_id this works if you have a field named parent in the same view.

0
votes

i assume you wanna put same value of partner_id in x_test field, then use related field

partner_id = fields.Many2one('res.partner', string="partner")
x_test =  fields.Many2one('res.partner',related='partner_id', string="X Test")

in XML

<field name="partner_id" required="1"/>
 <field name="x_test" />