Skip to content
Snippets Groups Projects
Commit f9ce42c7 authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] sale_timesheet: ZeroDivisionError

To avoid a division by zero.
Courtesy of @tbe-odoo

opw:1850023
parent 4c08e2a9
No related branches found
No related tags found
No related merge requests found
......@@ -56,8 +56,8 @@ class SaleTimesheetController(http.Controller):
dashboard_values['hours'][billable_type] = float_round(data.get('unit_amount'), precision_rounding=hour_rounding)
dashboard_values['hours']['total'] += float_round(data.get('unit_amount'), precision_rounding=hour_rounding)
# rates
dashboard_values['rates'][billable_type] = round(data.get('unit_amount') / dashboard_total_hours * 100, 2)
dashboard_values['rates']['total'] += round(data.get('unit_amount') / dashboard_total_hours * 100, 2)
dashboard_values['rates'][billable_type] = dashboard_total_hours and round(data.get('unit_amount') / dashboard_total_hours * 100, 2) or 0
dashboard_values['rates']['total'] += dashboard_total_hours and round(data.get('unit_amount') / dashboard_total_hours * 100, 2) or 0
# money_amount
so_lines = values['timesheet_lines'].mapped('so_line')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment