Reputation: 45
I have a little problem here.. as the title says, I'm passing some variables through the context in Odoo, but, they appear and disappear quickly. Part of my code:
<field name="onetomany_ids" nolabel="1" context="{'employee_id': employee_id,}" >
<tree string="Invoices">
<field name="employee_id" />
</tree>
</field>
As you can notice in the name that field is an One2many, it shows a tree with a link that allows adding a new record. So, when I click there, it shows the form, but the values that passed through context don't show. It should show the field employee filled with the employee that came from the previous view.
Upvotes: 1
Views: 745
Reputation: 14746
You should write as following :
<field name="onetomany_ids" nolabel="1" context="{'default_employee_id': employee_id,}" >
<tree string="Invoices">
<field name="employee_id" />
</tree>
</field>
Upvotes: 0