From 49de5a85d5af8a9c603737ba286888c7cded6374 Mon Sep 17 00:00:00 2001 From: hugues de keyzer Date: Mon, 6 Jan 2025 09:47:34 +0100 Subject: [PATCH] [IMP] simplify comment --- .../models/account_analytic_line.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/hr_timesheet_begin_end/models/account_analytic_line.py b/hr_timesheet_begin_end/models/account_analytic_line.py index 70a6e4dcf..5d1368727 100644 --- a/hr_timesheet_begin_end/models/account_analytic_line.py +++ b/hr_timesheet_begin_end/models/account_analytic_line.py @@ -21,15 +21,9 @@ class AccountAnalyticLine(models.Model): compute="_compute_unit_amount", store=True, readonly=False, - # This default is a workaround for a bizarre situation: if a line is - # created with a time range but WITHOUT defining unit_amount, then you - # would expect unit_amount to be computed from the range. But this never - # happens, and it is instead set to default value 0. Subsequently the - # constraint _validate_unit_amount_equal_to_time_diff kicks in and - # raises an exception. - # - # By setting the default to None, the computation is correctly - # triggered. If nothing is computed, None falls back to 0. + # remove the default of 0.0 to ensure it is computed when not + # provided. if not computed (because project_id is False), None is + # automatically converted to 0. default=None, )