From eb3e714befa44068fe52909b801654097adad1f6 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Sat, 4 Jul 2026 16:23:02 +0200 Subject: [PATCH] [OU-FIX] maintenance: keep maintenance_plan and maintenance_plan_activity The 17.0 apriori merges maintenance_plan and maintenance_plan_activity into core maintenance, following the deprecation announced in OCA/maintenance#414 / #468 (Feb 2025). That deprecation was later reverted: both modules were ported again and are alive and maintained on the 18.0 branch (Nov 2025 onwards, still updated mid 2026). Merging them on the 16->17 hop would destroy a live, heavily used feature set for databases that keep using the modules, and the 18.0 apriori has no entry to handle them afterwards. - apriori: drop the maintenance_plan / maintenance_plan_activity merge entries. base_maintenance_config and maintenance_plan_employee stay: those were never ported to 17.0/18.0, their merge is still right. - maintenance 17.0.1.0 scripts: drop the _maintenance_plan() helpers (note -> instruction_text rename and plan -> core recurrence conversion). They assume the merge happened; with the modules kept installed they would fight the modules' own schema and duplicate the recurrence logic. maintenance_plan rides the hop normally (it is ported to 17.0). maintenance_plan_activity has no 17.0 port: it is carried installed without code through 17 and updates again on the 17->18 hop. --- openupgrade_scripts/apriori.py | 2 -- .../maintenance/17.0.1.0/post-migration.py | 24 ------------------- .../maintenance/17.0.1.0/pre-migration.py | 17 ------------- 3 files changed, 43 deletions(-) diff --git a/openupgrade_scripts/apriori.py b/openupgrade_scripts/apriori.py index dc2f31e7c6f8..97882aad76d8 100644 --- a/openupgrade_scripts/apriori.py +++ b/openupgrade_scripts/apriori.py @@ -62,8 +62,6 @@ "l10n_es_irnr_sii": "l10n_es_aeat_sii_oca", # OCA/maintenance "base_maintenance_config": "maintenance", - "maintenance_plan": "maintenance", - "maintenance_plan_activity": "maintenance", "maintenance_plan_employee": "maintenance", # OCA/product-attribute "product_catalog": "product", diff --git a/openupgrade_scripts/scripts/maintenance/17.0.1.0/post-migration.py b/openupgrade_scripts/scripts/maintenance/17.0.1.0/post-migration.py index 014cf04cacc4..31d865530b0a 100644 --- a/openupgrade_scripts/scripts/maintenance/17.0.1.0/post-migration.py +++ b/openupgrade_scripts/scripts/maintenance/17.0.1.0/post-migration.py @@ -5,29 +5,6 @@ _deleted_xml_records = ["maintenance.mail_alias_equipment"] -def _maintenance_plan(env): - """Compatibility with maintenance_plan, we convert the request and - the recurrence field the way it is done in core. - """ - if openupgrade.column_exists(env.cr, "maintenance_request", "maintenance_plan_id"): - # Update all the data of the linked requests - openupgrade.logged_query( - env.cr, - """UPDATE maintenance_request mr - SET recurring_maintenance = True, - repeat_interval = COALESCE(mp.interval, 1), - repeat_unit = COALESCE(mp.interval_step, 'year'), - repeat_type='until', - repeat_until = ( - CURRENT_DATE + ('' - || COALESCE(mp.maintenance_plan_horizon, 1) || ' ' - || COALESCE(mp.planning_step, 'year'))::interval - )::date - FROM maintenance_plan mp - WHERE mr.maintenance_plan_id = mp.id""", - ) - - @openupgrade.migrate() def migrate(env, version): openupgrade.load_data(env, "maintenance", "17.0.1.0/noupdate_changes.xml") @@ -35,4 +12,3 @@ def migrate(env, version): env, _deleted_xml_records, ) - _maintenance_plan(env) diff --git a/openupgrade_scripts/scripts/maintenance/17.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/maintenance/17.0.1.0/pre-migration.py index 326d342d46a4..62e98936a2b6 100644 --- a/openupgrade_scripts/scripts/maintenance/17.0.1.0/pre-migration.py +++ b/openupgrade_scripts/scripts/maintenance/17.0.1.0/pre-migration.py @@ -3,22 +3,6 @@ from openupgradelib import openupgrade -def _maintenance_plan(env): - """Rename the fields if the maintenance_plan module was installed.""" - if openupgrade.column_exists(env.cr, "maintenance_request", "note"): - openupgrade.rename_fields( - env, - [ - ( - "maintenance.request", - "maintenance_request", - "note", - "instruction_text", - ), - ], - ) - - def _maintenance_request_company_id(env): """We set the company_id value for requests that do not have it. We get the value of what will be deductively most appropriate (equipment, team or @@ -50,4 +34,3 @@ def _maintenance_request_company_id(env): @openupgrade.migrate() def migrate(env, version): _maintenance_request_company_id(env) - _maintenance_plan(env)