Hi;
I have an issue and am stuck on ,
For the first time I want to display the sum of durations of the lines (from the timesheet lines) in a printout report.
and i have made this method for the format of the duration:
@classmethod
def format_duration(cls, duration , lang, digits=2, grouping=True,
monetary=None):
pool = Pool()
Lang = pool.get('ir.lang')
total_seconds = duration.total_seconds()
hours = total_seconds // 3600
minutes = (total_seconds % 3600) // 60
duration_hours = hours + minutes / 60
duration_days = duration_hours / 8
if lang is None:
lang = Lang.get()
return lang.format('%.' + str(digits) + 'f',
duration_days, grouping=grouping, monetary=monetary)
and here it’s the XML code:
<text:p text:style-name="P31"><text:placeholder text:placeholder-type="text"><format_duration(sum(line.duration for line in timesheet.lines))></text:placeholder></text:p>
when i have tried to print it , an error was displayed:
File "<string>", line 480, in <Expression '__relatorio_guess_type(__relatorio_store_cache(140377602530056, format_duration(sum(line.duration for line in timesheet.lines))))'>
TypeError: unsupported operand type(s) for +: 'int' and 'datetime.timedelta'
How i can solve it am stuck on.
Thanks in advance.