Skip to Content
Menu
This question has been flagged
1 Reply
2555 Views

I am trying to add months on a date but I am finding problems to make it.


I tried this:

<span t-set="d_delta" t-value="datetime.timedelta(months=1)"/>
<span t-set="d_dateorder" t-value="datetime.datetime.strptime(doc.date_order,'%Y-%m-%d %H:%M:%S')"/>
<span t-set="d_desdedia" t-value="d_dateorder + d_delta"/>
<span t-esc="d_desdedia.strftime('%d-%m-%Y')"/>


But doesnt work.... how can I make it?

Avatar
Discard
Best Answer


<span t-field="a.to_date" t-field-options='{"format": "dd/MM/yyyy"}'/>

the output will be like 31/12/2019 and for odoo 12 and above use


<span t-esc="o.date_invoice.strftime('%d/%m/%Y')"/>
Change your field names accordingly.


Avatar
Discard
Related Posts Replies Views Activity
0
Oct 24
144
0
Oct 24
5
1
May 23
1467
5
May 21
9865
5
Aug 20
29872