Skip to Content
Menu
This question has been flagged
4 Replies
2414 Views

Hi all Odoo developer , my question as below :

I declare field like this :  country_state = fields.Many2one('res.country', string='State', required=True)

and I use that filed ("country_state") in the view. then I see that field has some datas in its selection. Then I go to source code class (_name = 'res.country'). I dont see any function to return that datas in this class. My question is how they return all datas of country to that field (country_state)?

Avatar
Discard
Best Answer

Hello,

For any value of Many2one come form master data and you have use res.country that also has default data which one provided by Odoo.

You can also check-in Contacts --> Configuration --> Localization --> Countries.

another way you can check in pg-admin: select * from res_country

Thanks 

   

Avatar
Discard
Best Answer

Hi,

Many2one relation returns records of related model. For reference check this link

Avatar
Discard
Best Answer

Hi Tith SereySambath,

You can see the data's for res.country in PgAdmin database under table(res_country).

Avatar
Discard
Author Best Answer

Thank all of you for good explaination .

Avatar
Discard