Search code examples
pythonqwebodoo-11

odoo 11 date comparison in XML (qweb)


Hi have the following code:

Date: <t t-esc="Date()" /><br/><br/>
BirthDate: <t t-esc="record.x_birth_date.raw_value" /><br/><br/>
Due Date: <span t-esc="record.x_cust_document_due_date.raw_value"/><br/><br/>
Condition: <span t-esc="Date() gt record.x_cust_document_due_date.raw_value"/><br/>
Condition On BirthDate: <span t-esc="record.x_cust_document_due_date.raw_value lt record.x_birth_date.raw_value"/><br/>

The "Condition on BirthDate" (comparison with Birthdate and DueDate) is working fine, but the "Condition" (comparison between method Date() and DueDate) is always False.

The Output for the 3 Date and "Condition" is the following:

Date: Sat Jul 07 2018 18:01:09 GMT+0200 (Central European Summer Time)

BirthDate: Sun Jul 01 2018 02:00:00 GMT+0200 (Central European Summer Time)

Due Date: Thu Jun 28 2018 02:00:00 GMT+0200 (Central European Summer Time)

Condition: false

Condition On BirthDate: true

Can anyone help to understand what I'm missing?


Solution

  • For "Condition" use (new Date()) That would helpful to you..