Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
9371 Zobrazení

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
Zrušit
Nejlepší odpověď


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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
říj 24
68845
2
pro 23
25431
1
bře 15
6509
1
bře 15
6570
3
pro 23
21258