Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
5881 Weergaven

I want to to apply a logic on the list view 

There is a field x_doe (expiry date) for, If the Current date (system date) is 1 week due the date of expiry, the color of the view should become red...

can you please tell me how to apply that?

Avatar
Annuleer
Beste antwoord

Hi Suhaib,

You can simply define a computed field and then utilize that in decoration danger in list view.



Avatar
Annuleer
Beste antwoord

Hi,

As far as I know you won't be able to change the color of the date field itself in odoo 11, but you can make the record/line red in the listview by adding the following to the tree view tag in the list view 

decoration-danger="x_doe >= (context_today() + relativedelta(days=-7)).strftime('%Y-%m-%d')"

Example below is what I tested on Odoo demo site for sales orders.

<tree string="Quotation" class="o_sale_order" multi_edit="1" sample="1" decoration-danger="create_date >= (context_today() + relativedelta(days=-7)).strftime('%Y-%m-%d')" >

Kind Regards,

Avatar
Annuleer
Beste antwoord

you can take reference from the manufacturing orders tree view

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
mei 21
19019
1
jun. 18
9033
0
dec. 23
1336
1
mei 23
2856
1
sep. 22
8253