Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
13271 Ansichten

I am trying to have a field that will have 'no_open' set to True if a given condition is true and have it be False otherwise.

I tried using domain filters...

<field name="partner_id" string="Contact Search" options="{'no_open': [('stage_type_name','=','Rejected)]}" />

My expectation was that the no_open will be set to False if the condition was false and to True if it is true. But it didn't work out. It sets it to true regardless of the output of the domain filter. Then I did this:-

<field name="partner_id" string="Contact Search" attrs="{'invisible' : [('stage_type_name', '=', 'Rejected')]}" />
<field name="partner_id" string="Contact Search Readonly" attrs="{ 'invisible' : [('stage_type_name','!=','Rejected')]}" options="{'no_open': True}"/> 

I thought this should fix the issue but unfortunately the options automatically get taken from the last instance of the field for that field name. So it takes the options field from whichever ends up at the bottom. Invisible simply hides it from view rather than render it invalid.

I would like to set the option to True or False depending on a certain condition based on the value of a certain value in the form.

Avatar
Verwerfen

In your second solution, did you try to put no_open: True in the fist field and then no_open:False in the second ? Because i see that you added no_open: True to both fields

Autor

@ibrahim, sorry that was a mistake in my question. I had tried it properly in the actual code. Fixed the code in the question as well.

Beste Antwort

This doesn't answer your second question, but it might help other people reading this.  

Some attributes can be made conditional, whilst other cannot. As you have observed, although it's possible to add a domain filter to no_open it is ignored whereas this works fine for invisible and others.

And no_open blocks the "External Link" (screenshot here)

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Mai 24
2597
1
Nov. 22
4933
2
Juli 22
3678
2
Mai 18
9832
2
Juli 17
6790