-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
4 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
helpdesk_mgmt_project/migrations/16.0.2.2.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
"""Set the default_project_id value in the project company.""" | ||
env.cr.execute( | ||
""" | ||
SELECT htt.id, htt.old_default_project_id, pp.company_id | ||
FROM helpdesk_ticket_team htt | ||
JOIN project_project pp ON htt.old_default_project_id = pp.id | ||
WHERE htt.old_default_project_id IS NOT NULL | ||
""" | ||
) | ||
for team_id, old_default_project_id, company_id in env.cr.fetchall(): | ||
team = env["helpdesk.ticket.team"].with_company(company_id).browse(team_id) | ||
team.write({"default_project_id": old_default_project_id}) |
14 changes: 14 additions & 0 deletions
14
helpdesk_mgmt_project/migrations/16.0.2.2.0/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
column_renames = { | ||
"helpdesk_ticket_team": [("default_project_id", "old_default_project_id")], | ||
} | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
"""Rename the column to keep the old value.""" | ||
openupgrade.rename_columns(env.cr, column_renames) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters