Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2833 Vistas

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
Descartar
Mejor respuesta


<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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
4
ene 25
43359
0
oct 24
827
0
oct 24
5
1
may 23
2265
5
may 21
10749