Skip to content

Commit

Permalink
Merge PR #3765 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed Jul 6, 2023
2 parents ce32134 + 5b52e09 commit c05a637
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docsource/modules150-160.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Module coverage 15.0 -> 16.0
+-------------------------------------------------+----------------------+-------------------------------------------------+
| |del| coupon | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| crm | | |
| crm | Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| crm_iap_enrich | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
32 changes: 32 additions & 0 deletions openupgrade_scripts/scripts/crm/16.0.1.8/pre-migration.py
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 openupgrade_scripts/scripts/crm/16.0.1.8/upgrade_analysis_work.txt
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

0 comments on commit c05a637

Please sign in to comment.