Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
8834 Tampilan

I have a field which I would like present only for certain country:

<field name="org_no" attrs="{'invisible':[('country_id','!=','Sweden')]}"/>

country_id is default for 7.0:

country_id: fields.many2one('res.country', 'Country')

I understand that somehow I need to perform the search first - self.pool.get('res.country').search. But how to do it in a view?

Avatar
Buang
Jawaban Terbai


First solution is:

attrs = invisible:[('country_id.name', '!='  ,'Sweden' )]

second :

Create one related field

country_name = fields.Char(related='country_id.name', 'Coutnry name') add this field in as invisble

you can add attrs as below

attrs = invisible:[(country_name', '!='  ,'Sweden')]


Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Okt 24
68079
2
Des 23
24596
1
Mar 15
5955
1
Mar 15
6136
3
Des 23
20568