+1 (408) 663-2850 contact@eska.biz
Follow us

QWEB E-Mail Template Trick for Time and Date info like Estimated Date

Autofill a date info in email template from the record

I am pretty sure that you all were looking little solutions like automating perfect emails for your customers with specific details in the mails sent by the system.

In this scenario we want to send "Order Confirmation" mail with dynamic content as like as Estimated Delivery date which is allready declared in the Sales Order which is under "Other Info".

I have added this code in our template :

Estimated date of arrival is 
<span t-out="object.commitment_date"
t-options="{'widget': 'date', 'format': 'dd MMM Y'}">
​ <span t-out="(object.expected_date)+(datetime.timedelta(days=3))"
t-options="{'widget': 'date', 'format': 'dd MMM Y'}">
​</span>
</span>

The first span contains "Estimated (Commitment) Date" with the options for Date Format.But you may forget or not to prefer to fill that field but systems keeps an Expected Date which is Sale Order Creation Date. So we write second span if Estimated Date is empty we want to add +3 Days to creation date of Sale Order and write it in Sales Order Confirmation E-Mail template.

I hope this tricks helps you to understand of using QWEB Dynamic Placeholders inside templates.

How to activate Debug Mode
Behold! You have given true authority to smash the difficulties of ERP under your fingers. You can walk all over the power of the Odoo. You can’t lost time anymore.