summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2018-07-27 16:04:21 +0200
committerLucas Perais (lpe) <lpe@odoo.com>2018-07-30 13:18:04 +0200
commit44ea58234ec0d902ddf0caf7aefb367acc013627 (patch)
treedbbfae4dcc91be6badc2ed74062a5954edd9ff5a /addons
parent91d647ecf75d82ef26d16a96fc5c2930fbf835f7 (diff)
[FIX] base, hr_timesheet: display negative float_time values
Before this commit, negative values in a float field interpreted as time (i.e. unit_amount on analytic lines) were wrongly formatted After this commit, not only we correct the hr_timesheet qweb templates but we also correct the qweb widget to handle the case OPW 1869986 closes #26024
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_timesheet/report/report_timesheet_templates.xml6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/hr_timesheet/report/report_timesheet_templates.xml b/addons/hr_timesheet/report/report_timesheet_templates.xml
index fea714a5d7a..dbc0ad4a583 100644
--- a/addons/hr_timesheet/report/report_timesheet_templates.xml
+++ b/addons/hr_timesheet/report/report_timesheet_templates.xml
@@ -44,7 +44,7 @@
<t t-if="l.task_id"><span t-field="l.task_id.name"/></t>
</td>
<td class="text-right">
- <span t-esc="'%s:%02.0f' % tuple(int(round(x)) for x in divmod(l.unit_amount*60,60))"/>
+ <span t-field="l.unit_amount" t-options="{'widget': 'float_time'}"/>
</td>
</tr>
</t>
@@ -53,7 +53,9 @@
<td />
<td t-if="show_task"/>
<td class="text-right"><strong>Total</strong></td>
- <td class="text-right"><strong t-esc="'%s:%02.0f' % tuple(int(round(x)) for x in divmod(sum(docs.mapped('unit_amount'))*60,60))"/></td>
+ <t t-set="total_value" t-value="sum(docs.mapped('unit_amount'))" />
+ <t t-set="sign" t-value="'-' if total_value &lt; 0 else ''"/>
+ <td class="text-right"><strong t-esc="sign + '%s:%02.0f' % tuple(int(round(x)) for x in divmod(abs(total_value)*60,60))"/></td>
</tr>
</tbody>
</table>