Odoo Help


Default value for a field in different form

aci aisha
on 2/18/15, 4:02 AM 1,062 views


 I have a field ministry_or_not..(many2one)

I have to set its value as "Ministry" for the form view_trademark_file_form

and "Not Ministry" for view_tradename_form

any clue


Samuel Lefever
On 2/18/15, 4:46 AM

Use context in the action that call the view and prepend fieldname with "default_".

context: {'default_ministry_or_not': True}

Ingo Devooght
On 2/18/15, 5:05 AM


check out Settings/Parameters/Company Defaults or Company Properties. There you can define defaults.

Or do you need the default values in a module?



UPDATE (I can't post another message, so I must edit my old one):

Did you try in the module the _defaults statement?

_defaults = { 



Or maybe in the view you could change the default with properties:

<function model="ir.values" name="set_default">






In module

aci aisha
on 2/19/15, 1:27 AM

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

2 follower(s)


Asked: 2/18/15, 4:02 AM
Seen: 1062 times
Last updated: 3/16/15, 8:10 AM