hi, i m read this documentation. and found the related field so i want to understand actually how to use related field in country->state->city example.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
I normally use related fields only if I need some value from a parent model (M2O) to use it a view. Like when using domain filters, making fields invisible/readonly, itd.. Else just use M2O fields. Even with related fields you need a M2O field to use it in relate.
For your example I think you can't the way you want. The res_country_state model has the country_id, so you could get the country name from the res_country_state model and not the other way around.
country_name = fields.Char(relate='country_id.name')
You do not need to create related field you just use many2one field to access it.
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
1
mrt. 15
|
5371 | ||
|
0
jun. 15
|
3024 | ||
|
2
aug. 24
|
2246 | ||
|
2
jun. 19
|
2788 | ||
|
0
mrt. 24
|
3199 |
you want to fetch country name from state->country?