Skip to content

Commit

Permalink
Merge PR #184 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Nov 7, 2024
2 parents 211cf3d + 69238aa commit f0351a1
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions hr_attendance_modification_tracking/models/hr_attendance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ class HrAttendance(models.Model):
"be applied.",
)

@api.model
def create(self, vals):
@api.model_create_multi
def create(self, vals_list):
tolerance = timedelta(seconds=60)
now = fields.Datetime.now()
for check in ["check_in", "check_out"]:
if (
vals.get(check, False)
and abs(fields.Datetime.from_string(vals.get(check)) - now) > tolerance
):
vals.update({"time_changed_manually": True})
break
return super().create(vals)
for vals in vals_list:
for check in ["check_in", "check_out"]:
if (
vals.get(check, False)
and abs(fields.Datetime.from_string(vals.get(check)) - now)
> tolerance
):
vals.update({"time_changed_manually": True})
break
return super().create(vals_list)

def write(self, vals):
tolerance = timedelta(seconds=60)
Expand Down

0 comments on commit f0351a1

Please sign in to comment.