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

In order to warn our clients about the time spent on their tasks and the time remaining on the contract, I am trying to make an email template.

However the problem is that I have a different display of the hours:

Example on the client task:
Scheduled time: 60:00
Hours used: 01:10
Hours remaining: 58:50

In the email template we created here is what is displayed at the hours level:

Scheduled time: 60.0
Hours used: 1.17
Hours left: 58.83

The problem is that this type of display is not understandable to the customer.

Here is the code we used in the mail template:

t t-out="object.planned_hours" data-oe-t-inline="true" style="box-sizing:border-box;" contenteditable="false"

t t-out="object.total_hours_spent" data-oe-t-inline="true" style="box-sizing:border-box;" contenteditable="false"

t t-out="object.remaining_hours" data-oe-t-inline="true" style="box-sizing:border-box;" contenteditable="false"

How can we do to display the times in the classic way (hh: mm) as is the case in the timesheet of a task?

Thank you in advance for your help !


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

Hello, Thanks for the reply but I don't think I can use this syntax in template mail ?

I was just setting an example. You need to change the display right? If odoo works like that let it be.

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

Indeed I need to change the display to make it more understandable for my clients.

However, I would need a syntax that works in the mail templates!

Do you have any idea how to do it?

Аватар
Відмінити
Найкраща відповідь

Have you tried just converting it yourself? Taking all the hours and the remaining like that but instead of minutes and seconds using hours and minutes:

print(f'{(time.time() - start_time)/60:.0f}min {(time.time() - start_time)%60:.0f}s')


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