Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
13621 Представления

<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/>

I have using above code but i get this error:

Error to render compiling AST
TypeError: 'NoneType' object is not callable
Template: 1733
Path: /templates/t/t/form/div[2]/div[2]/div/p[1]/span
Node: <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/>

Can You help me to fix above problem?


Аватар
Отменить
Лучший ответ

context_timestamp support only for report rendering. 

<span t-esc="datetime.datetime.now().strftime('%Y-%m-%d')"></span>

Note: above syntex will work but it will print the date in server timezone. 

Аватар
Отменить
Лучший ответ

You can try:

<span t-esc="context_timestamp(datetime.date.today()).strftime('%Y-%m-%d')"/>



Аватар
Отменить