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

Hi,

I'm trying to make a gadget that shows a banner when someone has birthday the given day.

As a first step, I have tried to compare just a single number (lets say 08 for August) in the birthday date, but the code generates internal server error.

I tried to do strftime directly on employee.birthday in a t-if, but it was unsuccessful.


I have also tried to compare it with exact dates (the way they show when printed with t-esc (div t-if="employee.birthday == '1958-02-22'")

, but that was unsuccessful also. Anyone got any good suggestions?

EDIT: Post was not displayed correctly because of the code. Re-tried with removed brackets and added a comment with the code.
Аватар
Отменить
Автор

Trying to post the actual code, but it only appears in white....

data inherit_id="web.layout"
xpath expr="//body" position="inside"
div t-foreach="request.env['hr.employee'].search([])" t-as="employee"
t t-set="bday" t-value="employee.birthday.strftime('%m-%d')"/
div t-if="bday like '08'"
div style="width: 100%; padding: 5px; background-color: #D0442C; color: #f0f0f0; text-align: center;"August match /div
/div
/div
/xpath
/data

puedes enseñarme si lo lograste? quiero eso mismo para ver aniversarios de todos mis contactos.

Лучший ответ

Hi,

Please check the format of the birthday date received from the employee. It may be not in the format '1958-02-22'

please check with the below code(div t-if="employee.birthday.strftime('%Y-%m-%d') == '1958-02-22'")


Hope it helps

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
мая 25
559
1
февр. 25
763
0
апр. 25
856
0
окт. 24
678
7
сент. 24
24259