Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2560 มุมมอง

Hello everyone,

i need to add a domian in Many2one field that exist in One2many Field 

###### country Model ####

country= fields.Char(string=" country ")


##### city Model ###

country _ids = fields.Many2one(comodel_name='  country ')

city = fields.Char(string="City")

###### Visit Model ####

visit =  fields.Char(string="Visit")

city_ids = fields.Many2one(comodel_name=' city ')

#######

let's suppose that i have this data:

country: USA, SPAIN, ITALIE

city: 

[USA: NEW YOUR, MIAMI,Colorado ]

[SPAIN: MADRID, BARCALONE]

[ITALIE: ROMA, NAPOLI]

#######

###### visit planning #####

date =   fields.Date(string="Visit")

country =  fields.Many2one(comodel_name='  country ')

city =  fields.One2many(comodel_name='  city ')


so i want at this point that when i select a country for Example SPAIN

i want to see only   MADRID and BARCALONE in my One2many field


how can i do that and thank you


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I fix this problem with this domain: 

* you need to use this word "parent" 

domain="[('country','=',parent. country )]"

that's it 

thank you

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 19
1837
1
ก.ย. 17
4870
1
มี.ค. 23
1507
0
ธ.ค. 22
2134
Domain with inherited field แก้ไขแล้ว
1
ต.ค. 22
3050