Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] hr_timesheet_overtime: Preserve default value of unit_amount #37

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading