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.


Python - Populating many2one field on loading of form OpenERP

Saghir A. Khatri
on 9/12/14, 3:29 AM 745 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


| 5 4 7
Bangalore, India

Techno-Functional Associate with 6+ 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....

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: 9/12/14, 3:29 AM
Seen: 745 times
Last updated: 3/16/15, 8:10 AM