Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2564 Tampilan

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)



Avatar
Buang

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')"/>

Penulis

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.

Penulis

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"}'/>

Penulis

yes, but it gives me datetime with timezone

Penulis

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"}'/>

Penulis

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')"/>

Jawaban Terbai

Then try convert it:

t-esc="datetime.datetime.strptime(receipt.date.validation_date, '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')"


Avatar
Buang
Penulis

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')"

Post Terkait Replies Tampilan Aktivitas
1
Jan 23
4387
0
Mei 22
2240
0
Mar 22
127
1
Jul 24
2851
2
Agu 23
2403