Search code examples
python-3.xtreeviewodoodecoration

Changing the color in tree view when there is a difference of 15 days between two dates in odoo 13


I am working on changing the color in tree view in odoo 13 for colorize tree view when there is a difference of 15 days between two dates for example I have this when one is bigger than the other

tree decoration-danger=" (date1 > date2)"

but i need when there is a difference of 15 days between two dates.

Thanks


Solution

  • You should persist a boolean field diff_15: True if difference(date1, date2) > 15 and False otherwise, then use this field in your XML to achieve the proper class decoration-danger="diff_15 == True"

    I hope this can be helpful for you.