Skip to content

Commit

Permalink
[8.0.1.2.0][hr_timesheet_computation_overtime] Revision
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Nov 11, 2020
1 parent d48b318 commit 1b45b5b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions hr_timesheet_computation_overtime/models/hr_overtime_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ def button_link_to_timesheet(self):
@api.constrains(
"sheet_id",
"state",
"company_id.overtime_check_timesheet",
)
def _check_timesheet(self):
obj_overtime = self.env[self._name]
if self.state in ["confirm", "valid"]:
criteria = [
("sheet_id", "=", False),
("company_id.overtime_check_timesheet", "<>", False),
]
if obj_overtime.search_count(criteria) > 0:
raise UserError(_("Timesheet cannot be empty"))
if (
self.state in ["confirm", "valid"] and not
self.sheet_id and
self.company_id.overtime_check_timesheet
):
raise UserError(_("Timesheet cannot be empty"))

0 comments on commit 1b45b5b

Please sign in to comment.