how to set default value for many2one field
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
find the id of that default value and give it to the many2one field using _defaults = ...
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?
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
3
paź 18
|
40794 | ||
|
0
wrz 22
|
60 | ||
|
2
sie 22
|
3247 | ||
|
0
gru 21
|
2696 | ||
How to set a default value in debug mode?
Rozwiązane
|
|
1
sty 17
|
6539 |