Odoo Help


Python - Populating many2one field on loading of form OpenERP

Saghir A. Khatri
on 9/12/14, 3:29 AM 1,140 views

I am trying to load my form's many2one field when form load's with a query to populate filtered ids of product. I achieved this in my Onchange method, but i am not sure how i can do it on loading of form in many2one field.

All I want here is to return the results of the query to my product_id field which is a many2one field.?

Can you tell us the query that you are doing for getting the product_id? Maybe you can define something like: _defualts={'product_id' = _query_function,}. But this depends on the query...

on 9/15/14, 1:26 PM

Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 9/15/14, 10:20 AM

use context...

set context like  {'default_FIELD': VALUE} on the many2one field... which will help you to set default value while loading the many2one form....

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/12/14, 3:29 AM
Seen: 1140 times
Last updated: 3/16/15, 8:10 AM