From e3b0e00de7cc3a8cb68e7f9c17576f3c13dbf0a4 Mon Sep 17 00:00:00 2001 From: haumenphai Date: Fri, 17 May 2024 15:58:22 +0700 Subject: [PATCH] [OU-ADD] resource: migrate to 17.0 --- docsource/modules160-170.rst | 2 +- .../resource/17.0.1.1/post-migration.py | 17 +++++++++++++++ .../resource/17.0.1.1/pre-migration.py | 16 ++++++++++++++ .../resource/17.0.1.1/upgrade_analysis.txt | 1 - .../17.0.1.1/upgrade_analysis_work.txt | 21 +++++++++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 openupgrade_scripts/scripts/resource/17.0.1.1/post-migration.py create mode 100644 openupgrade_scripts/scripts/resource/17.0.1.1/pre-migration.py create mode 100644 openupgrade_scripts/scripts/resource/17.0.1.1/upgrade_analysis_work.txt diff --git a/docsource/modules160-170.rst b/docsource/modules160-170.rst index 0ae89b703492..5e29bc138eb4 100644 --- a/docsource/modules160-170.rst +++ b/docsource/modules160-170.rst @@ -744,7 +744,7 @@ Module coverage 16.0 -> 17.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | repair | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| resource | | | +| resource |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | sale | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/resource/17.0.1.1/post-migration.py b/openupgrade_scripts/scripts/resource/17.0.1.1/post-migration.py new file mode 100644 index 000000000000..c5a96e223050 --- /dev/null +++ b/openupgrade_scripts/scripts/resource/17.0.1.1/post-migration.py @@ -0,0 +1,17 @@ +# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + +_deleted_xml_records = [ + "resource.resource_calendar_std_35h", + "resource.resource_calendar_std_38h", +] + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.delete_records_safely_by_xml_id( + env, + _deleted_xml_records, + ) diff --git a/openupgrade_scripts/scripts/resource/17.0.1.1/pre-migration.py b/openupgrade_scripts/scripts/resource/17.0.1.1/pre-migration.py new file mode 100644 index 000000000000..2423ea505409 --- /dev/null +++ b/openupgrade_scripts/scripts/resource/17.0.1.1/pre-migration.py @@ -0,0 +1,16 @@ +# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.set_xml_ids_noupdate_value( + env, + "resource", + [ + "resource_calendar_std", + ], + True, + ) diff --git a/openupgrade_scripts/scripts/resource/17.0.1.1/upgrade_analysis.txt b/openupgrade_scripts/scripts/resource/17.0.1.1/upgrade_analysis.txt index 44c34ac8768d..937fec75433a 100644 --- a/openupgrade_scripts/scripts/resource/17.0.1.1/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/resource/17.0.1.1/upgrade_analysis.txt @@ -5,7 +5,6 @@ resource / resource.calendar.attendance / _order : _o resource / resource.calendar.attendance / day_period (selection) : selection_keys is now '['afternoon', 'lunch', 'morning']' ('['afternoon', 'morning']') resource / resource.calendar.attendance / duration_days (float) : NEW hasdefault: compute ---XML records in module 'resource'--- -DEL ir.model.constraint: resource.constraint_resource_resource_check_time_efficiency resource.calendar: resource.resource_calendar_std (noupdate) (noupdate switched) DEL resource.calendar: resource.resource_calendar_std_35h (noupdate) DEL resource.calendar: resource.resource_calendar_std_38h (noupdate) diff --git a/openupgrade_scripts/scripts/resource/17.0.1.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/resource/17.0.1.1/upgrade_analysis_work.txt new file mode 100644 index 000000000000..04d232058ed2 --- /dev/null +++ b/openupgrade_scripts/scripts/resource/17.0.1.1/upgrade_analysis_work.txt @@ -0,0 +1,21 @@ +---Models in module 'resource'--- +---Fields in module 'resource'--- +resource / resource.calendar / hours_per_day (float) : now a function +# Nothing To Do, compute non-stored + +resource / resource.calendar.attendance / _order : _order is now 'sequence, week_type, dayofweek, hour_from' ('week_type, dayofweek, hour_from') +# Nothing To Do, default order when search + +resource / resource.calendar.attendance / day_period (selection) : selection_keys is now '['afternoon', 'lunch', 'morning']' ('['afternoon', 'morning']') +# Nothing To Do, new option: lunch + +resource / resource.calendar.attendance / duration_days (float) : NEW hasdefault: compute +# Nothing To Do, no need precomputation + +---XML records in module 'resource'--- +resource.calendar: resource.resource_calendar_std (noupdate) (noupdate switched) +# DONE: switched noupdate + +DEL resource.calendar: resource.resource_calendar_std_35h (noupdate) +DEL resource.calendar: resource.resource_calendar_std_38h (noupdate) +# DONE: safely delete in post-migration