Odoo Help


set a default value in one form based on the value in another form.

on 7/7/14, 5:49 AM 531 views


I have two classes (say class.a, class.b). 

In class.a form, I have two fields (say field1, field2). field1 is a char, field2 is a many2one relation with class.b.

In class.b is having two fields (say fb1, fb2 both are char). 


While selecting a value for field2 in class.a, if I click on create & Edit in the drop down, class.b form will appear. But I want fb2 field to be autofilled with field1 value in class.a.


Please help me with a solution.

Thanks in Advance.





René Schuster

--René Schuster--
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 7/7/14, 5:55 AM

In your view for class a, add a context to the many2one field.

<field name="class_b_id" context="{'default_fb2': field1}"/>



On 7/7/14, 6:22 AM

Thank You René Schuster  it worked.

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 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: 7/7/14, 5:49 AM
Seen: 531 times
Last updated: 3/16/15, 8:10 AM