Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
9574 Vues

how to set default value for many2one field

Avatar
Ignorer
Meilleure réponse

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

Avatar
Ignorer
Auteur

I have to write a function for default

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?

Publications associées Réponses Vues Activité
3
oct. 18
40845
0
sept. 22
60
2
août 22
3345
0
déc. 21
2783
1
janv. 17
6602