Skip to content

Commit

Permalink
[FIX] hr_timesheet_overtime: Preserve default value of unit_amount
Browse files Browse the repository at this point in the history
Signed-off-by: Carmen Bianca BAKKER <[email protected]>
  • Loading branch information
carmenbianca committed Jul 4, 2024
1 parent ab3ca34 commit 1296725
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hr_timesheet_overtime/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ def _update_values(self, values):
Update values if date or unit_amount fields have changed
"""
if "date" in values or "unit_amount" in values:
# TODO: self.date and self.unit_amount do not exist when called from
# create().
# If called from create() without unit_amount, don't do anything.
# This preserves the default value.
if not self and "unit_amount" not in values:
return
date = values.get("date", self.date)
unit_amount = values.get("unit_amount", self.unit_amount)
values["unit_amount"] = unit_amount * self.rate_for_date(date)
Expand Down

0 comments on commit 1296725

Please sign in to comment.