From 87ed64b79536bf6b189ff308fc85a75a554c52f5 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 9 Feb 2026 08:00:53 +0100 Subject: [PATCH] [MIG] resource --- docsource/modules180-190.rst | 2 +- .../resource/19.0.1.1/post-migration.py | 19 +++++++++++ .../19.0.1.1/upgrade_analysis_work.txt | 33 +++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 openupgrade_scripts/scripts/resource/19.0.1.1/post-migration.py create mode 100644 openupgrade_scripts/scripts/resource/19.0.1.1/upgrade_analysis_work.txt diff --git a/docsource/modules180-190.rst b/docsource/modules180-190.rst index a0448b5ac97a..46cdb5b0c6fb 100644 --- a/docsource/modules180-190.rst +++ b/docsource/modules180-190.rst @@ -978,7 +978,7 @@ Module coverage 18.0 -> 19.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | repair | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| resource | | | +| resource |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | resource_mail | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/resource/19.0.1.1/post-migration.py b/openupgrade_scripts/scripts/resource/19.0.1.1/post-migration.py new file mode 100644 index 000000000000..24d8c2c06ffd --- /dev/null +++ b/openupgrade_scripts/scripts/resource/19.0.1.1/post-migration.py @@ -0,0 +1,19 @@ +# Copyright 2026 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + + +def resource_calendar_flexible_hours(env): + """ + In v19, flexible_hours is computed from schedule_type which didn't exist in v18, + so we set schedule_type according to flexible_hours + """ + env.cr.execute( + "UPDATE resource_calendar SET schedule_type='flexible' WHERE flexible_hours" + ) + + +@openupgrade.migrate() +def migrate(env, version): + resource_calendar_flexible_hours(env) diff --git a/openupgrade_scripts/scripts/resource/19.0.1.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/resource/19.0.1.1/upgrade_analysis_work.txt new file mode 100644 index 000000000000..482784b33485 --- /dev/null +++ b/openupgrade_scripts/scripts/resource/19.0.1.1/upgrade_analysis_work.txt @@ -0,0 +1,33 @@ +---Models in module 'resource'--- +---Fields in module 'resource'--- +resource / resource.calendar / duration_based (boolean) : NEW + +# NOTHING TO DO: new feature + +resource / resource.calendar / flexible_hours (boolean) : now a function + +# NOTHING TO DO + +resource / resource.calendar / hours_per_week (float) : NEW hasdefault: compute + +# NOTHING TO DO: computed by ORM + +resource / resource.calendar / schedule_type (selection) : NEW required, selection_keys: ['flexible', 'fully_fixed'], hasdefault: default + +# DONE: computed from flexible_hours in post_migration + +resource / resource.calendar.attendance / date_from (date) : DEL +resource / resource.calendar.attendance / date_to (date) : DEL +resource / resource.calendar.attendance / day_period (selection) : selection_keys added: [full_day] (most likely nothing to do) + +# NOTHING TO DO + +resource / resource.calendar.attendance / duration_hours (float) : is now stored + +# NOTHING TO DO: computed by ORM + +resource / resource.calendar.attendance / resource_id (many2one) : DEL relation: resource.resource + +# NOTHING TO DO + +---XML records in module 'resource'---