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

[15.0][MIG] crm: migration script #3502

Merged
merged 1 commit into from
Aug 1, 2022
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
2 changes: 1 addition & 1 deletion docsource/modules140-150.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Module coverage 14.0 -> 15.0
+-------------------------------------------------+----------------------+-------------------------------------------------+
| coupon | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| crm | | |
| crm | Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| |new| crm_iap_enrich | |Renamed from crm_iap_lead_enrich. |
+-------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
17 changes: 17 additions & 0 deletions openupgrade_scripts/scripts/crm/15.0.1.6/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from openupgradelib import openupgrade


def try_delete_noupdate_records(env):
openupgrade.delete_records_safely_by_xml_id(
env,
[
"crm.mail_alias_lead_info",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about removing this one...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"crm.email_template_opportunity_mail",
],
)


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env.cr, "crm", "15.0.1.6/noupdate_changes.xml")
try_delete_noupdate_records(env)
14 changes: 14 additions & 0 deletions openupgrade_scripts/scripts/crm/15.0.1.6/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.convert_field_to_html(env.cr, "crm_lead", "description", "description")
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE crm_team_member
ADD COLUMN assignment_max INTEGER DEFAULT 30;
ALTER TABLE crm_team_member ALTER COLUMN assignment_max DROP DEFAULT;
""",
)
70 changes: 70 additions & 0 deletions openupgrade_scripts/scripts/crm/15.0.1.6/upgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---Models in module 'crm'---
new model crm.lead.pls.update [transient]
# NOTHING TO DO

---Fields in module 'crm'---
crm / crm.lead / calendar_event_ids (one2many) : NEW relation: calendar.event
crm / crm.lead / company_currency (many2one) : not related anymore
crm / crm.lead / company_currency (many2one) : now a function
crm / crm.lead / company_id (many2one) : now a function
# NOTHING TO DO: Handle by ORM

crm / crm.lead / description (text) : type is now 'html' ('text')
# DONE: pre-migration: convert text to html

crm / crm.team / assignment_domain (char) : NEW
crm / crm.team / assignment_optout (boolean) : NEW
crm / crm.team.member / assignment_domain (char) : NEW
# NOTHING TO DO: new feature

crm / crm.team.member / assignment_max (integer) : NEW hasdefault
# DONE: pre-migration: create and set default value for column 'assignment_max' is 30

crm / crm.team.member / assignment_optout (boolean) : NEW
crm / res.partner / meeting_count (integer) : module is now 'calendar' ('crm')
crm / res.partner / meeting_ids (many2many) : module is now 'calendar' ('crm')
crm / res.users / meeting_count (integer) : module is now 'calendar' ('crm')
crm / res.users / meeting_ids (many2many) : module is now 'calendar' ('crm')
# NOTHING TO DO: Handle by ORM

---XML records in module 'crm'---
NEW crm.lead.scoring.frequency.field: crm.frequency_field_tag_ids (noupdate)
NEW ir.actions.act_window: crm.action_lead_mail_compose
NEW ir.actions.act_window: crm.crm_lead_action_forecast
NEW ir.actions.act_window: crm.crm_lead_action_open_lead_form
NEW ir.actions.act_window: crm.crm_lead_pls_update_action
DEL ir.actions.act_window: crm.crm_lead_act_window_compose
NEW ir.actions.act_window.view: crm.action_report_crm_lead_salesteam_view_graph
NEW ir.actions.act_window.view: crm.action_report_crm_lead_salesteam_view_pivot
NEW ir.actions.act_window.view: crm.action_report_crm_lead_salesteam_view_tree
NEW ir.actions.act_window.view: crm.crm_lead_action_forecast_view_graph
NEW ir.actions.act_window.view: crm.crm_lead_action_forecast_view_kanban
NEW ir.actions.act_window.view: crm.crm_lead_action_forecast_view_pivot
NEW ir.actions.act_window.view: crm.crm_lead_action_forecast_view_tree
NEW ir.actions.server: crm.action_opportunity_forecast
NEW ir.cron: crm.ir_cron_crm_lead_assign (noupdate)
NEW ir.model.access: crm.crm_lead_pls_update_access_system
DEL ir.model.access: crm.access_crm_lead_partner_manager
NEW ir.ui.menu: crm.crm_menu_forecast
NEW ir.ui.menu: crm.crm_team_member_config
NEW ir.ui.view: crm.crm_action_helper
NEW ir.ui.view: crm.crm_lead_pls_update_view_form
NEW ir.ui.view: crm.crm_lead_view_graph_forecast
NEW ir.ui.view: crm.crm_lead_view_kanban_forecast
NEW ir.ui.view: crm.crm_lead_view_pivot_forecast
NEW ir.ui.view: crm.crm_lead_view_search_forecast
NEW ir.ui.view: crm.crm_lead_view_tree_forecast
NEW ir.ui.view: crm.crm_team_member_view_form
NEW ir.ui.view: crm.crm_team_member_view_kanban
NEW ir.ui.view: crm.crm_team_member_view_tree
NEW ir.ui.view: crm.crm_team_view_kanban_dashboard
NEW ir.ui.view: crm.crm_team_view_tree
DEL ir.ui.view: crm.assets_backend
DEL ir.ui.view: crm.assets_tests
DEL ir.ui.view: crm.crm_team_salesteams_view_kanban
DEL ir.ui.view: crm.qunit_suite
# NOTHING TO DO

DEL mail.alias: crm.mail_alias_lead_info (noupdate)
DEL mail.template: crm.email_template_opportunity_mail (noupdate)
# DONE: post-migration: safely deleted xmlids