Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][OU-FIX] helpdesk_mgmt_project: Migration script was not working when migrating from a previous major version #669

Merged
merged 1 commit into from
Dec 18, 2024
Merged
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
4 changes: 4 additions & 0 deletions helpdesk_mgmt_project/migrations/16.0.2.2.0/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@

from openupgradelib import openupgrade

from odoo.tools.sql import column_exists


@openupgrade.migrate()
def migrate(env, version):
"""Set the default_project_id value in the project company."""
if not column_exists(env.cr, "helpdesk_ticket_team", "old_default_project_id"):
return
env.cr.execute(
"""
SELECT htt.id, htt.old_default_project_id, pp.company_id
Expand Down
5 changes: 4 additions & 1 deletion helpdesk_mgmt_project/migrations/16.0.2.2.0/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from openupgradelib import openupgrade

from odoo.tools.sql import column_exists

column_renames = {
"helpdesk_ticket_team": [("default_project_id", "old_default_project_id")],
}
Expand All @@ -11,4 +13,5 @@
@openupgrade.migrate()
def migrate(env, version):
"""Rename the column to keep the old value."""
openupgrade.rename_columns(env.cr, column_renames)
if column_exists(env.cr, "helpdesk_ticket_team", "default_project_id"):
openupgrade.rename_columns(env.cr, column_renames)
Loading