Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions openupgrade_scripts/apriori.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 0 additions & 24 deletions openupgrade_scripts/scripts/maintenance/17.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,10 @@
_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")
openupgrade.delete_records_safely_by_xml_id(
env,
_deleted_xml_records,
)
_maintenance_plan(env)
17 changes: 0 additions & 17 deletions openupgrade_scripts/scripts/maintenance/17.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -50,4 +34,3 @@ def _maintenance_request_company_id(env):
@openupgrade.migrate()
def migrate(env, version):
_maintenance_request_company_id(env)
_maintenance_plan(env)
Loading