Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Pre-select parent item in many2one popup

on 5/5/15, 5:15 AM 765 views

Let's start with a basic One2many relation, a class Parent and a class Child.

When I open a Parent form and try to create a new Child from the one2many popup opend by the "child_ids" form field, the parent_id field is not selected with the current open Parent from the window view ! I have to retrieve it in the parent_id selection field to re-select it.

Is there a way to do this autoselection ?


On 5/5/15, 7:53 AM

Hello SITER,

For autoselect the parent_id you have to pass parent_id in context like this,

<field name="child_ids" context="{'default_parent_id': active_id}"/>

Here active_id = cuurent id of parent object.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 5/5/15, 5:15 AM
Seen: 765 times
Last updated: 5/19/15, 12:13 PM