Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
3962 Vizualizări

Hello everybody!!!

I have a field named type_id which is a many2one to a table hr.contract.type. (where its fields are id, name, ...)

I want to make a field named Date_end invisible when the name of the contract is "CDI".

I tried like this : <field name="date_end" attrs="{'invisible':[('type_id.name,'=',"CDI")]}"/>

But it doesnt work.

Can anyone help please.

Thanks a lot in advance.

Best Regards.

Imagine profil
Abandonează
Cel mai bun răspuns

Add the contract name as a related field in the contract object then change the domain in xml

<field name="date_end" attrs="{'invisible':[('my_related_field','=','CDI')]}"/>

NOTE : The code you posted has some errors it should be like this :

<field name="date_end" attrs="{'invisible':[('type_id.name','=','CDI')]}"/>

Let us now how it went for you !

Imagine profil
Abandonează
Cel mai bun răspuns

Hello DressFar,


Try this :-

First Solution:-

<field name="date_end" attrs ="{'invisible': {'type_id': [('name', '=', 'CDI')]}}" / >


Second Solution :-

In py:-

type_id = fields.Many2one ("hr.contract.type", 'Type')

type_name = fields.Char(related='type_id.name', 'Type Name')

In Xml:-

<field name="type_id" attrs="{'invisible': [('type_name', '=', 'CDI')]}" />

<field name="type_name" invisible="1"/>


Hope it works for you.

Thanks,

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
mar. 15
3741
2
apr. 18
27859
0
oct. 15
4155
2
aug. 25
2228
1
iul. 25
763