-
-
Notifications
You must be signed in to change notification settings - Fork 696
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 legalsylvain
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
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
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,32 @@ | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
_field_renames = [("crm.lead", "crm_lead", "lost_reason", "lost_reason_id")] | ||
|
||
|
||
def res_partner_compute_team_id(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE res_partner as p | ||
SET team_id = res.parent_team_id | ||
FROM( | ||
SELECT p.id, parent.team_id | ||
FROM res_partner p | ||
JOIN res_partner parent | ||
ON p.parent_id = parent.id | ||
WHERE p.team_id IS NULL | ||
AND p.is_company='f' | ||
AND parent.team_id IS NOT NULL | ||
) as res(partner_id, parent_team_id) | ||
WHERE p.id = res.partner_id | ||
""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.rename_fields(env, _field_renames) | ||
res_partner_compute_team_id(env) |
19 changes: 19 additions & 0 deletions
19
openupgrade_scripts/scripts/crm/16.0.1.8/upgrade_analysis_work.txt
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,19 @@ | ||
---Models in module 'crm'--- | ||
---Fields in module 'crm'--- | ||
crm / crm.lead / lead_properties (properties) : NEW hasdefault: compute | ||
# NOTHING TO DO: new feature | ||
|
||
crm / crm.lead / lost_reason (many2one) : DEL relation: crm.lost.reason | ||
crm / crm.lead / lost_reason_id (many2one) : NEW relation: crm.lost.reason | ||
# DONE: pre-migration: rename column | ||
|
||
crm / crm.team / lead_properties_definition (properties_definition): NEW | ||
# NOTHING TO DO: new feature | ||
|
||
crm / res.partner / team_id (False) : NEW mode: modify, hasdefault: compute | ||
# DONE: pre-migration: compute value in DB | ||
|
||
---XML records in module 'crm'--- | ||
NEW ir.ui.view: crm.crm_lead_merge_summary | ||
NEW ir.ui.view: crm.crm_lead_view_tree_reporting | ||
# NOTHING TO DO |