Odoo Help


default value for many2one field

on 7/18/13, 7:11 AM 2,992 views

how to set default value for many2one field

Sreedath Namangalam
On 7/18/13, 8:52 AM

find the id of that default value and give it to the many2one field using _defaults = ...

I have to write a function for default

on 7/18/13, 11:14 AM

Suppose I have a many2many relationship from a module "x" with partners. then, the relationship of this many2many fields, becomes a many2one (between the items selected for partners and invoice). I have limited the domain for this relationship in the invoice using domain="[('partner_ids', '=', partner_id)] in the view. It works but now I want to get the first of these items (in the invoice) as the default one. So, actually I don't know the id of the item because it varies for each partner. I just want selected as default the first one in the list. How could I do this?

Daniel Blanco
on 4/10/15, 5:50 PM

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

0 follower(s)


Asked: 7/18/13, 7:11 AM
Seen: 2992 times
Last updated: 3/16/15, 8:10 AM