Skip to Content
Menu
This question has been flagged
2 Replies
2982 Views

this code is working but the problem is the condition(attrs).

<label for="date_due" string="Due Date"/>
<span>
   <div attrs="{'invisible': [('date_due','>', 'date_today')]}">
           <field name="date_due"  style="color:black"/>
   </div>
   <div attrs="{'invisible': [('date_due','&lt;', 'date_today')]}" >
            <field name="date_due" style="color:red"/>
   </div>
</span>


This code works only on the second condition, is there any way to do this problem?

and also give us idea about the current date in xml code.

Avatar
Discard
Author Best Answer


Avatar
Discard
Best Answer

Hi,

Instead of greater than (>) use '&gt;'

So update the code like this,

<div attrs="{'invisible': [('date_due','&gt;', 'date_today')]}">
<field name="date_due" style="color:black"/>
</div>


Thanks

Avatar
Discard
Author

I have tried that already, look on the condition.

if the first condition is "true" and the second is "false", there's no display.

But if the first condition is "false" and the second is "true", there's a display for the second condition.