diff --git a/docsource/modules150-160.rst b/docsource/modules150-160.rst index cb5a964c216b..21a9b34fd6db 100644 --- a/docsource/modules150-160.rst +++ b/docsource/modules150-160.rst @@ -102,7 +102,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | |del| coupon | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| crm | | | +| crm |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | crm_iap_enrich | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/crm/16.0.1.8/pre-migration.py b/openupgrade_scripts/scripts/crm/16.0.1.8/pre-migration.py new file mode 100644 index 000000000000..c4b2057e1852 --- /dev/null +++ b/openupgrade_scripts/scripts/crm/16.0.1.8/pre-migration.py @@ -0,0 +1,36 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +_column_renames = { + "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_columns(env.cr, _column_renames) + res_partner_compute_team_id(env) diff --git a/openupgrade_scripts/scripts/crm/16.0.1.8/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/crm/16.0.1.8/upgrade_analysis_work.txt new file mode 100644 index 000000000000..98c6b9c9296b --- /dev/null +++ b/openupgrade_scripts/scripts/crm/16.0.1.8/upgrade_analysis_work.txt @@ -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 \ No newline at end of file