Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
2591 Переглядів

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)



Аватар
Відмінити

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

Найкраща відповідь

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

Related Posts Відповіді Переглядів Дія
1
січ. 23
4408
0
трав. 22
2255
0
бер. 22
127
1
лип. 24
2868
2
серп. 23
2419