Skip to content

Commit

Permalink
[FIX] Run pre-commit
Browse files Browse the repository at this point in the history
Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
  • Loading branch information
carmenbianca committed May 16, 2022
1 parent c3761aa commit 79e4f8c
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 37 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ ignore = E123,E133,E226,E241,E242,F811,F601,W503,W504,E203
max-line-length = 88
per-file-ignores=
__init__.py:F401

1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,3 @@ enable=anomalous-backslash-in-string,
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

1 change: 0 additions & 1 deletion .pylintrc-mandatory
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ enable=anomalous-backslash-in-string,
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

4 changes: 1 addition & 3 deletions hr_timesheet_auto_creation/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ def create_employee_timesheet(self):
sunday = monday + timedelta(days=6)
# Search for existing timesheet
exists_timesheet_records = self.search([("date_end", ">=", monday)])
ignore_employee_ids = map(
lambda x: x.employee_id.id, exists_timesheet_records
)
ignore_employee_ids = map(lambda x: x.employee_id.id, exists_timesheet_records)
employee_ids = list(set(employee_ids) - set(ignore_employee_ids))
sudo_self = self.sudo()
for employee_id in employee_ids:
Expand Down
8 changes: 2 additions & 6 deletions hr_timesheet_overtime/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def get_working_hours(self, start_date, end_date=None):
end_dt = tz.localize(
datetime(end_date.year, end_date.month, end_date.day)
) + timedelta(days=1)
work_time_per_day = self.list_normal_work_time_per_day(
start_dt, end_dt
)
work_time_per_day = self.list_normal_work_time_per_day(start_dt, end_dt)
# .list_normal_work_time_per_day() returns a list of tuples:
# (date, work time)
return sum(work_time[1] for work_time in work_time_per_day)
Expand All @@ -83,9 +81,7 @@ def _compute_current_day_working_hours(self):
"""
current_day = date.today()
for employee in self:
employee.current_day_working_hours = employee.get_working_hours(
current_day
)
employee.current_day_working_hours = employee.get_working_hours(current_day)

@api.multi
def _compute_has_overtime_access(self):
Expand Down
5 changes: 1 addition & 4 deletions hr_timesheet_overtime/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ def _compute_timesheet_overtime(self):
employee = sheet.employee_id
start_date = sheet.date_start
end_date = sheet.date_end
if (
current_day < start_date
or employee.overtime_start_date > end_date
):
if current_day < start_date or employee.overtime_start_date > end_date:
sheet.timesheet_overtime = 0.0
continue
if employee.overtime_start_date > start_date:
Expand Down
8 changes: 2 additions & 6 deletions hr_timesheet_overtime/tests/test_overtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ def setUp(self):
self.contract1 = self.env["hr.contract"].create(contract_dict)

# projects
self.project_01 = self.env["project.project"].create(
{"name": "Project 01"}
)
self.project_01 = self.env["project.project"].create({"name": "Project 01"})

# create ts
ts1_dict = {
Expand Down Expand Up @@ -270,9 +268,7 @@ def test_overtime_05(self):
)

self.assertEqual(self.ts2.timesheet_overtime, 0)
self.assertEqual(
self.ts2.total_overtime, 1
) # 1 hour overtime from ts1
self.assertEqual(self.ts2.total_overtime, 1) # 1 hour overtime from ts1

def test_overtime_archived_timesheet(self):
"""
Expand Down
4 changes: 1 addition & 3 deletions hr_timesheet_sheet_prefill/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@
class Employee(models.Model):
_inherit = "hr.employee"

project_ids = fields.Many2many(
comodel_name="project.project", string="Projects"
)
project_ids = fields.Many2many(comodel_name="project.project", string="Projects")
4 changes: 1 addition & 3 deletions hr_timesheet_sheet_prefill/models/project_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@
class Project(models.Model):
_inherit = "project.project"

employee_ids = fields.Many2many(
comodel_name="hr.employee", string="Employees"
)
employee_ids = fields.Many2many(comodel_name="hr.employee", string="Employees")
12 changes: 3 additions & 9 deletions hr_timesheet_sheet_prefill/tests/test_timesheet_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ def setUp(self):
super().setUp()

# projects
self.project_01 = self.env["project.project"].create(
{"name": "Project 01"}
)
self.project_02 = self.env["project.project"].create(
{"name": "Project 02"}
)
self.project_01 = self.env["project.project"].create({"name": "Project 01"})
self.project_02 = self.env["project.project"].create({"name": "Project 02"})

def test_timesheet_creation_fail_linked_employee(self):
# unlinked employee
unlinked_employee_dict = {"name": "Unlinked Employee"}
unlinked_employee = self.env["hr.employee"].create(
unlinked_employee_dict
)
unlinked_employee = self.env["hr.employee"].create(unlinked_employee_dict)

ts_unlinked_employee_dict = {
"employee_id": unlinked_employee.id,
Expand Down

0 comments on commit 79e4f8c

Please sign in to comment.