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

[14.0][MIG] crm #2828

Merged
merged 2 commits into from
Jul 20, 2021
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/modules130-140.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Module coverage 13.0 -> 14.0
+--------------------------------------------+-------------------------------------------------+
| |new| coupon | |
+--------------------------------------------+-------------------------------------------------+
|crm | |
|crm | Done |
+--------------------------------------------+-------------------------------------------------+
|crm_iap_lead | |
+--------------------------------------------+-------------------------------------------------+
Expand Down
8 changes: 4 additions & 4 deletions openupgrade_scripts/scripts/crm/14.0.1.2/noupdate_changes.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<record id="crm_activity_report_rule_multi_company" model="ir.rule">
<!-- <record id="crm_activity_report_rule_multi_company" model="ir.rule">
<field name="global"/>
</record>
</record> -->
<record id="frequency_field_country_id" model="crm.lead.scoring.frequency.field">
<field name="field_id" ref="crm.field_crm_lead__country_id"/>
</record>
Expand Down Expand Up @@ -39,8 +39,8 @@
<record id="mt_salesteam_lead_won" model="mail.message.subtype">
<field name="parent_id" ref="mt_lead_won"/>
</record>
<record id="sales_team.team_sales_department" model="crm.team" forcecreate="False">
<!-- <record id="sales_team.team_sales_department" model="crm.team" forcecreate="False">
<field name="alias_name">info</field>
<field name="alias_user_id" ref="base.user_admin"/>
</record>
</record> -->
</odoo>
11 changes: 11 additions & 0 deletions openupgrade_scripts/scripts/crm/14.0.1.2/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env.cr, "crm", "14.0.1.2/noupdate_changes.xml")
openupgrade.delete_records_safely_by_xml_id(
env, [("crm.crm_pls_rebuild_threshold_param")]
)
22 changes: 22 additions & 0 deletions openupgrade_scripts/scripts/crm/14.0.1.2/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com>
# Copyright 2021 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr, "ALTER TABLE crm_lead ADD recurring_revenue_monthly NUMERIC"
)
openupgrade.logged_query(
env.cr, "ALTER TABLE crm_lead ADD recurring_revenue_monthly_prorated NUMERIC"
)
openupgrade.rename_fields(
env,
[
("crm.lead", "crm_lead", "expected_revenue", "prorated_revenue"),
("crm.lead", "crm_lead", "planned_revenue", "expected_revenue"),
],
)
openupgrade.rename_tables(env.cr, [("crm_lead_tag_rel", "crm_tag_rel")])
118 changes: 118 additions & 0 deletions openupgrade_scripts/scripts/crm/14.0.1.2/upgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---Models in module 'crm'---
obsolete model crm.lead.tag (renamed to crm.tag in module sales_team)
obsolete model crm.partner.binding [transient]
new model crm.recurring.plan
# NOTHING TO DO

---Fields in module 'crm'---
crm / crm.lead / probability (float) : now a function
crm / crm.lead / automated_probability (float) : now a function
# NOTHING TO DO: Computed writable field + already stored field

crm / crm.lead / city (char) : now a function
crm / crm.lead / contact_name (char) : now a function
crm / crm.lead / country_id (many2one) : now a function
crm / crm.lead / email_from (char) : now a function
crm / crm.lead / function (char) : now a function
crm / crm.lead / mobile (char) : now a function
crm / crm.lead / name (char) : now a function
crm / crm.lead / partner_name (char) : now a function
crm / crm.lead / phone (char) : now a function
crm / crm.lead / phone_sanitized (char) : NEW isfunction: function, stored
crm / crm.lead / state_id (many2one) : now a function
crm / crm.lead / street (char) : now a function
crm / crm.lead / street2 (char) : now a function
crm / crm.lead / title (many2one) : now a function
crm / crm.lead / website (char) : now a function
crm / crm.lead / zip (char) : now a function
crm / crm.lead / stage_id (many2one) : now a function
crm / crm.lead / team_id (many2one) : now a function
# NOTHING TO DO: Switched to computed writable fields (replacement of onchanges)

crm / crm.lead / date_last_stage_update (datetime): now a function
crm / crm.lead / date_open (datetime) : now a function
# NOTHING TO DO: Already stored fields

crm / crm.lead / recurring_revenue_monthly (float): NEW isfunction: function, stored
crm / crm.lead / recurring_revenue_monthly_prorated (float): NEW isfunction: function, stored
# DONE: pre-migration: pre-create fields for not having any useless computation

crm / crm.lead / phone_mobile_search (char) : NEW
# NOTHING TO DO: it has store=False and it's only for searching purposes

crm / crm.lead / expected_revenue (float) : not a function anymore
crm / crm.lead / planned_revenue (float) : DEL
crm / crm.lead / prorated_revenue (float) : NEW isfunction: function, stored
# DONE: pre-migration: renamed fields in the proper order: expected > prorrated; planned > expected

crm / crm.lead / recurring_plan (many2one) : NEW relation: crm.recurring.plan
crm / crm.lead / recurring_revenue (float) : NEW
# NOTHING TO DO: related to new crm.recurring.plan model

crm / crm.lead / tag_ids (many2many) : relation is now 'crm.tag' ('crm.lead.tag') [nothing to do]
crm / crm.lead / tag_ids (many2many) : table is now 'crm_tag_rel' ('crm_lead_tag_rel')
# DONE: pre-migration: renamed table

crm / crm.lead.tag / __last_update (datetime) : module is now 'sales_team' ('crm')
crm / crm.lead.tag / _order : module is now 'sales_team' ('crm')
crm / crm.lead.tag / color (integer) : module is now 'sales_team' ('crm')
crm / crm.lead.tag / display_name (char) : module is now 'sales_team' ('crm')
crm / crm.lead.tag / name (char) : module is now 'sales_team' ('crm')
# NOTHING TO DO: handled by ORM

crm / crm.recurring.plan / active (boolean) : NEW hasdefault
crm / crm.recurring.plan / name (char) : NEW required
crm / crm.recurring.plan / number_of_months (integer) : NEW required
crm / crm.recurring.plan / sequence (integer) : NEW hasdefault
# NOTHING TO DO: new feature

crm / crm.team / opportunities_amount (integer): type is now 'float' ('integer')
# NOTHING TO DO: It's not stored

---XML records in module 'crm'---
NEW crm.recurring.plan: crm.crm_recurring_plan_monthly (noupdate)
NEW crm.recurring.plan: crm.crm_recurring_plan_over_3_years (noupdate)
NEW crm.recurring.plan: crm.crm_recurring_plan_over_5_years (noupdate)
NEW crm.recurring.plan: crm.crm_recurring_plan_yearly (noupdate)
NEW digest.tip: crm.digest_tip_crm_1
NEW digest.tip: crm.digest_tip_crm_2
NEW digest.tip: crm.digest_tip_crm_3
NEW digest.tip: crm.digest_tip_crm_4
NEW digest.tip: crm.digest_tip_crm_5
NEW ir.actions.act_window: crm.crm_lead_act_window_compose
NEW ir.actions.act_window: crm.crm_lead_action_my_activities
NEW ir.actions.act_window: crm.crm_recurring_plan_action
NEW ir.actions.act_window.view: crm.crm_lead_action_my_activities_view_tree
NEW ir.model.access: crm.access_crm_lead2opportunity_partner
NEW ir.model.access: crm.access_crm_lead2opportunity_partner_mass
NEW ir.model.access: crm.access_crm_lead_lost
NEW ir.model.access: crm.access_crm_merge_opportunity
NEW ir.model.access: crm.crm_recurring_plan_access_manager
NEW ir.model.access: crm.crm_recurring_plan_access_salesman
NEW ir.ui.menu: crm.crm_lead_menu_my_activities
NEW ir.ui.menu: crm.crm_recurring_plan_menu_config
NEW ir.ui.view: crm.crm_lead_view_list_activities
NEW ir.ui.view: crm.crm_recurring_plan_view_search
NEW ir.ui.view: crm.crm_recurring_plan_view_tree
NEW ir.ui.view: crm.qunit_suite
NEW ir.ui.view: crm.view_crm_case_my_activities_filter
NEW res.groups: crm.group_use_recurring_revenues
# NOTHING TO DO: New records

DEL ir.config_parameter: crm.crm_pls_rebuild_threshold_param (noupdate)
# DONE: post-migration: safely deleted xmlid

DEL ir.actions.act_window: crm.crm_team_act_tree
DEL ir.actions.act_window: crm.relate_partner_opportunities
DEL ir.actions.act_window.view: crm.relate_partner_opportunities_kanban
DEL ir.actions.act_window.view: crm.relate_partner_opportunities_tree
DEL ir.ui.view: crm.crm_lead_view_tree_activity
# NOTHING TO DO: Delete records with no correspondence

DEL ir.actions.act_window: crm.crm_lead_tag_action
DEL ir.ui.view: crm.crm_lead_tag_form
DEL ir.ui.view: crm.crm_lead_tag_tree
DEL ir.model.access: crm.access_crm_lead_tag
DEL ir.model.access: crm.access_crm_lead_tag_manager
DEL ir.model.access: crm.access_crm_lead_tag_salesman
# NOTHING TO DO: Renamed in sales_team
12 changes: 12 additions & 0 deletions openupgrade_scripts/scripts/sales_team/14.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com>
# Copyright 2021 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade

Expand All @@ -21,3 +22,14 @@ def migrate(env, version):
openupgrade.set_xml_ids_noupdate_value(
env, "sales_team", ["crm_rule_all_salesteam", "sale_team_comp_rule"], True
)
openupgrade.rename_xmlids(
env.cr,
[
("crm.crm_lead_tag_action", "sales_team.sales_team_crm_tag_action"),
("crm.crm_lead_tag_form", "sales_team.sales_team_crm_tag_view_form"),
("crm.crm_lead_tag_tree", "sales_team.sales_team_crm_tag_view_tree"),
("crm.access_crm_lead_tag", "sales_team.access_crm_tag"),
("crm.access_crm_lead_tag_manager", "sales_team.access_crm_tag_manager"),
("crm.access_crm_lead_tag_salesman", "sales_team.access_crm_tag_salesman"),
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ sales_team / crm.lead.tag / name (char) : previo

---XML records in module 'sales_team'---
NEW ir.actions.act_window: sales_team.sales_team_crm_tag_action
NEW ir.ui.view: sales_team.sales_team_crm_tag_view_form
NEW ir.ui.view: sales_team.sales_team_crm_tag_view_tree
NEW ir.model.access: sales_team.access_crm_tag
NEW ir.model.access: sales_team.access_crm_tag_manager
NEW ir.model.access: sales_team.access_crm_tag_salesman
# NOTHING TO DO
# DONE: pre-migration: Renamed from crm module

ir.rule: sales_team.crm_rule_all_salesteam (noupdate) (noupdate switched)
ir.rule: sales_team.sale_team_comp_rule (noupdate) (noupdate switched)
# DONE: pre-migration: switched noupdate

NEW ir.ui.view: sales_team.sales_team_crm_tag_view_form
NEW ir.ui.view: sales_team.sales_team_crm_tag_view_tree
# NOTHING TO DO