Skip to content

Commit be40c0d

Browse files
Merge pull request OCA#5255 from ForgeFlow/18.0-mig-attendance
[18.0][OU-ADD] hr_attendance
2 parents 89ecbff + bbdc84c commit be40c0d

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

docsource/modules170-180.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Module coverage 17.0 -> 18.0
164164
+---------------------------------------------------+----------------------+-------------------------------------------------+
165165
| hr |Done | |
166166
+---------------------------------------------------+----------------------+-------------------------------------------------+
167-
| hr_attendance | | |
167+
| hr_attendance |Done | |
168168
+---------------------------------------------------+----------------------+-------------------------------------------------+
169169
| |new| hr_calendar | | |
170170
+---------------------------------------------------+----------------------+-------------------------------------------------+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from openupgradelib import openupgrade
4+
5+
_new_columns = [
6+
("hr.attendance", "expected_hours", "float"),
7+
("hr.attendance", "overtime_status", "selection", "approved"),
8+
("hr.attendance", "validated_overtime_hours", "float"),
9+
("res.company", "absence_management", "boolean", False),
10+
("res.company", "attendance_overtime_validation", "selection", "no_validation"),
11+
("res.company", "auto_check_out", "boolean", False),
12+
("res.company", "auto_check_out_tolerance", "float", 2),
13+
]
14+
15+
16+
def fill_hr_attendance_expected_hours(env):
17+
openupgrade.logged_query(
18+
env.cr,
19+
"""
20+
UPDATE hr_attendance
21+
SET expected_hours = COALESCE(worked_hours, 0) - COALESCE(overtime_hours, 0)
22+
""",
23+
)
24+
25+
26+
def fill_hr_attendance_validated_overtime_hours(env):
27+
openupgrade.logged_query(
28+
env.cr,
29+
"""
30+
UPDATE hr_attendance
31+
SET validated_overtime_hours = COALESCE(overtime_hours, 0)
32+
""",
33+
)
34+
35+
36+
@openupgrade.migrate()
37+
def migrate(env, version=None):
38+
openupgrade.add_columns(env, _new_columns)
39+
fill_hr_attendance_expected_hours(env)
40+
fill_hr_attendance_validated_overtime_hours(env)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---Models in module 'hr_attendance'---
2+
---Fields in module 'hr_attendance'---
3+
hr_attendance / hr.attendance / expected_hours (float) : NEW isfunction: function, stored
4+
# DONE: pre-migration: pre-created and filled
5+
6+
hr_attendance / hr.attendance / in_mode (selection) : selection_keys is now '['kiosk', 'manual', 'systray', 'technical']' ('['kiosk', 'manual', 'systray']')
7+
hr_attendance / hr.attendance / out_mode (selection) : selection_keys is now '['auto_check_out', 'kiosk', 'manual', 'systray', 'technical']' ('['kiosk', 'manual', 'systray']')
8+
hr_attendance / hr.attendance / overtime_status (selection) : NEW selection_keys: ['approved', 'refused', 'to_approve'], isfunction: function, stored
9+
hr_attendance / hr.attendance / validated_overtime_hours (float): NEW hasdefault: compute
10+
# DONE: pre-migration: pre-created and filled
11+
12+
hr_attendance / res.company / absence_management (boolean) : NEW hasdefault: default
13+
hr_attendance / res.company / attendance_overtime_validation (selection): NEW selection_keys: ['by_manager', 'no_validation'], hasdefault: default
14+
hr_attendance / res.company / auto_check_out (boolean) : NEW hasdefault: default
15+
hr_attendance / res.company / auto_check_out_tolerance (float): NEW hasdefault: default
16+
# DONE: pre-migration: pre-created and filled
17+
18+
hr_attendance / res.company / hr_attendance_overtime (boolean): DEL
19+
hr_attendance / res.company / overtime_start_date (date) : DEL
20+
# NOTHING TO DO: deprecated fields (https://github.com/odoo/odoo/commit/cac96f5d3c391ea0d52da2e3433e7eabe07e8fb0)
21+
22+
---XML records in module 'hr_attendance'---
23+
NEW ir.actions.act_window: hr_attendance.hr_attendance_management_action
24+
NEW ir.actions.client: hr_attendance.hr_attendance_action_install_kiosk_pwa
25+
NEW ir.actions.server: hr_attendance.action_load_demo_data
26+
NEW ir.actions.server: hr_attendance.action_try_kiosk
27+
NEW ir.cron: hr_attendance.hr_attendance_absence_cron
28+
NEW ir.cron: hr_attendance.hr_attendance_check_out_cron
29+
NEW ir.ui.menu: hr_attendance.menu_action_open_form
30+
NEW ir.ui.menu: hr_attendance.menu_hr_attendance_view_attendances_management
31+
DEL ir.ui.menu: hr_attendance.menu_hr_attendance_kiosk_no_user_mode
32+
NEW ir.ui.view: hr_attendance.hr_attendance_management_view_filter
33+
NEW ir.ui.view: hr_attendance.hr_attendance_overtime_view_pivot
34+
NEW ir.ui.view: hr_attendance.hr_attendance_validated_hours_employee_simple_tree_view
35+
NEW ir.ui.view: hr_attendance.view_attendance_overtime_graph
36+
NEW ir.ui.view: hr_attendance.view_attendance_tree_management
37+
# NOTHING TO DO

0 commit comments

Comments
 (0)