Hello guys,
for odoo15 community
i am trying to do a date format for the blow in the pos receipt, i have tried many options lie t-options and t-esc-options also widgets with no luck it always get the date, time and timezone (+02:00)
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello guys,
for odoo15 community
i am trying to do a date format for the blow in the pos receipt, i have tried many options lie t-options and t-esc-options also widgets with no luck it always get the date, time and timezone (+02:00)
Then try convert it:
t-esc="datetime.datetime.strptime(receipt.date.validation_date, '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')"
i got the error below
TypeError: Cannot read properties of undefined (reading 'datetime')
at QWeb.eval (eval at _compile (owl.js:1786:1), <anonymous>:299:39)
at QWeb.render (owl.js:1716:1)
at OrderReceipt.__render (owl.js:4586:1)
at OrderReceipt.__updateProps (owl.js:4494:1)
Try like this:
t-esc="receipt.date.validation_date.strftime('%Y-%m-%d')"
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
ene 23
|
4372 | ||
|
0
may 22
|
2228 | ||
|
0
mar 22
|
127 | ||
|
1
jul 24
|
2828 | ||
|
2
ago 23
|
2395 |
Have you tried this:
https://www.odoo.com/forum/help-1/what-are-options-to-format-date-in-the-pos-receipt-82291
<t t-esc="new Date().toString('d MMMM yyyy')"/>
i am using <span t-if="!receipt.date.localestring" t-esc="receipt.date.validation_date"/>
Try temporarily:
<span t-if="!receipt.date.localestring" t-esc="1000"/>
Just to check if you are changing the correct line.
yes i am sure that i am changing the correct line as it takes affect exactly where i need, also i have change it with the line you provided me and it show 1000
Have you tried it like this:
<span t-if="!receipt.date.localestring" t-esc="receipt.date.validation_date" t-field-options='{"format": "MM/dd/yyyy"}'/>
yes, but it gives me datetime with timezone
after time it show +02:00
Does it work like this?
<span t-if="!receipt.date.localestring" t-field="receipt.date.validation_date" t-options='{"format": "MM/dd/yyyy"}'/>
tried it and not working got error
Error: Unknown QWeb directive: 't-field'
at QWeb._compileNode (owl.js:1870:1)
at QWeb._compileChildren (owl.js:2173:1)
at QWeb._compileNode (owl.js:1968:1)
at QWeb._compileChildren (owl.js:2173:1)
at QWeb._compileNode (owl.js:1968:1)
at QWeb._compileChildren (owl.js:2173:1)
at QWeb._compileNode (owl.js:1968:1)
at QWeb._compileChildren (owl.js:2173:1)
at QWeb._compileNode (owl.js:1968:1)
at QWeb._compileChildren (owl.js:2173:1)
Try to convert it:
<span t-if="!receipt.date.localestring" t-esc="datetime.datetime.strptime(receipt.date.validation_date, '%Y-%m-%d').strftime('%d %b %Y')"/>