Is it possible to change datetime in Email Template?
Example:
| |
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Is it possible to change datetime in Email Template?
Example:
| |
yes, It is possible to change datetime in email template. Please use the below code sample in your email template. It will work.
${(datetime.datetime.strptime(object.date_start,'%Y-%m-%d %H:%M:%S') + relativedelta(hours=5,minutes=30)).strftime('%Y-%m-%d %H:%M:%S')}
Above code will add +05:30 in date_start datetime.
Hey Nilesh,
Thanks much. This really worked for me. I just replaced the body_html code at four places in the meeting invite email template, with your code and it works great.
Existing code:
${object.event_id.get_interval(object.event_id.start, 'dayname', tz=object.partner_id.tz)}
Replaced with your sample code:
${object.event_id.get_interval(((datetime.datetime.strptime(object.event_id.start,'%Y-%m-%d %H:%M:%S') + relativedelta(hours=5,minutes=30)).strftime('%Y-%m-%d %H:%M:%S')), 'dayname', tz=object.partner_id.tz)}
Basically replace "object.event_id.start" with
"((datetime.datetime.strptime(object.event_id.start,'%Y-%m-%d %H:%M:%S') + relativedelta(hours=5,minutes=30)).strftime('%Y-%m-%d %H:%M:%S'))"
First instance is for 'dayname', the other is for 'day', next for 'month' and finally 'time'.
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
Take Users Timezone
Opgelost
|
|
3
jul. 25
|
3813 | |
Time & Date Issue
Opgelost
|
|
6
sep. 19
|
11114 | |
|
0
mrt. 15
|
8057 | ||
Datetime and Time Zones - OpenERP 7
Opgelost
|
|
1
jan. 24
|
12626 | |
|
4
mrt. 23
|
14497 |