Skip to content

Commit

Permalink
[IMP] simplify comment
Browse files Browse the repository at this point in the history
  • Loading branch information
huguesdk committed Jan 6, 2025
1 parent b601c05 commit 49de5a8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions hr_timesheet_begin_end/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down

0 comments on commit 49de5a8

Please sign in to comment.