From b425a140b9db7ace4af3db19163658859e5baf89 Mon Sep 17 00:00:00 2001 From: Alexander Bigga Date: Thu, 30 Nov 2023 14:30:50 +0100 Subject: [PATCH] Revert "[ADD] keep 0 overtime records" --- verdigado_attendance/__manifest__.py | 3 --- verdigado_attendance/data/ir_cron.xml | 5 ---- verdigado_attendance/data/res_company.xml | 9 ------- ...t-fix-hr_attendance_missing_days-config.py | 18 ------------- verdigado_attendance/models/hr_attendance.py | 25 ------------------- 5 files changed, 60 deletions(-) delete mode 100644 verdigado_attendance/data/ir_cron.xml delete mode 100644 verdigado_attendance/data/res_company.xml delete mode 100644 verdigado_attendance/migrations/15.0.1.0.1/post-fix-hr_attendance_missing_days-config.py diff --git a/verdigado_attendance/__manifest__.py b/verdigado_attendance/__manifest__.py index 6182cd5..1e63826 100644 --- a/verdigado_attendance/__manifest__.py +++ b/verdigado_attendance/__manifest__.py @@ -17,7 +17,6 @@ "hr_attendance_autoclose", "hr_attendance_break", "hr_attendance_break_autoclose", - "hr_attendance_missing_days", "hr_holidays_attendance", "l10n_de_holidays", "hr_holidays_public_overtime", @@ -27,8 +26,6 @@ "data": [ "data/base_ical.xml", "data/hr_leave_type.xml", - "data/ir_cron.xml", - "data/res_company.xml", "data/res.lang.csv", "security/verdigado_attendance.xml", "security/ir.model.access.csv", diff --git a/verdigado_attendance/data/ir_cron.xml b/verdigado_attendance/data/ir_cron.xml deleted file mode 100644 index ecc6c77..0000000 --- a/verdigado_attendance/data/ir_cron.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/verdigado_attendance/data/res_company.xml b/verdigado_attendance/data/res_company.xml deleted file mode 100644 index 61f1bfb..0000000 --- a/verdigado_attendance/data/res_company.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/verdigado_attendance/migrations/15.0.1.0.1/post-fix-hr_attendance_missing_days-config.py b/verdigado_attendance/migrations/15.0.1.0.1/post-fix-hr_attendance_missing_days-config.py deleted file mode 100644 index a6d6067..0000000 --- a/verdigado_attendance/migrations/15.0.1.0.1/post-fix-hr_attendance_missing_days-config.py +++ /dev/null @@ -1,18 +0,0 @@ -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version=None): - """Force load hr_attendance_missing_days' configuration""" - openupgrade.load_data( - env.cr, - "verdigado_attendance", - "data/ir_cron.xml", - ) - openupgrade.load_data( - env.cr, - "verdigado_attendance", - "data/res_company.xml", - ) - # and recreate possibly missing overtime - env["hr.attendance"].search([])._update_overtime() diff --git a/verdigado_attendance/models/hr_attendance.py b/verdigado_attendance/models/hr_attendance.py index 3c391ac..3b6c28b 100644 --- a/verdigado_attendance/models/hr_attendance.py +++ b/verdigado_attendance/models/hr_attendance.py @@ -10,28 +10,3 @@ class HrAttendance(models.Model): check_in = DatetimeWithoutSeconds() check_out = DatetimeWithoutSeconds() - - def _update_overtime(self, employee_attendance_dates=None): - """Recreate missing overtime records""" - result = super()._update_overtime( - employee_attendance_dates=employee_attendance_dates - ) - if employee_attendance_dates is None: - employee_attendance_dates = self._get_attendances_dates() - missing_vals = [] - for employee, attendance_dates in employee_attendance_dates.items(): - dates = [attendance_date for _dummy, attendance_date in attendance_dates] - existing_overtime = self.env["hr.attendance.overtime"].search( - [ - ("employee_id", "=", employee.id), - ("company_id", "=", self.env.company.id), - ("date", "in", dates), - ] - ) - missing_vals += [ - {"employee_id": employee.id, "date": attendance_date} - for attendance_date in set(dates) - - set(existing_overtime.mapped("date")) - ] - self.env["hr.attendance.overtime"].create(missing_vals) - return result