跳至內容
選單
此問題已被標幟
2 回覆
1426 瀏覽次數
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')


頭像
捨棄