diff --git a/docsource/modules150-160.rst b/docsource/modules150-160.rst index be3e74354428..65b02bfaa0bd 100644 --- a/docsource/modules150-160.rst +++ b/docsource/modules150-160.rst @@ -176,7 +176,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | hr_gamification | Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| hr_holidays | | | +| hr_holidays | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | hr_holidays_attendance | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/hr_holidays/16.0.1.5/post-migration.py b/openupgrade_scripts/scripts/hr_holidays/16.0.1.5/post-migration.py index 18e6b76f40b8..70aef7b5c96b 100644 --- a/openupgrade_scripts/scripts/hr_holidays/16.0.1.5/post-migration.py +++ b/openupgrade_scripts/scripts/hr_holidays/16.0.1.5/post-migration.py @@ -1,28 +1,25 @@ # Copyright 2023 Coop IT Easy (https://coopiteasy.be) +# Copyright 2024 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openupgradelib import openupgrade -def set_allocation_validation_type(env): - """Operate like the _compute_allocation_validation_type() function. - - It set "no" by default except if employee_request is set to "no" - where it set "officer". +def _set_allocation_validation_type(env): + """Convert the previous `set` value to `officer` as it's mostly the same. The only + difference is that previously if set is selected, the responsible could be empty, + and thus the own user was selected as approver - which was incorrect -. """ - openupgrade.logged_query( - env.cr, "UPDATE hr_leave_type SET allocation_validation_type = 'no'" - ) openupgrade.logged_query( env.cr, """UPDATE hr_leave_type SET allocation_validation_type = 'officer' - WHERE employee_requests = 'no' + WHERE allocation_validation_type = 'set' """, ) @openupgrade.migrate() def migrate(env, version): - set_allocation_validation_type(env) + _set_allocation_validation_type(env) openupgrade.load_data(env.cr, "hr_holidays", "16.0.1.5/noupdate_changes.xml") diff --git a/openupgrade_scripts/scripts/hr_holidays/16.0.1.5/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/hr_holidays/16.0.1.5/upgrade_analysis_work.txt index 1c0b66f10163..2bf32ed40eba 100644 --- a/openupgrade_scripts/scripts/hr_holidays/16.0.1.5/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/hr_holidays/16.0.1.5/upgrade_analysis_work.txt @@ -23,7 +23,7 @@ hr_holidays / hr.leave.stress.day / start_date (date) : NEW re # NOTHING TO DO: new feature hr_holidays / hr.leave.type / allocation_validation_type (selection): selection_keys is now '['no', 'officer']' ('['no', 'officer', 'set']') -# DONE: post-migration: compute new value for allocation_validation_type +# DONE: post-migration: convert previous `set` values to `officer`. They acted the same except the responsible_id is not set. In that case, the user was selected as approver, which was incorrect. ---XML records in module 'hr_holidays'--- NEW ir.actions.act_window: hr_holidays.hr_leave_stress_day_action