[19.0][OU-ADD] crm: stage.team_id m2o→m2m promotion#5643
Conversation
72f6b98 to
66cc730
Compare
|
/ocabot migration crm @dnplkndll Please avoid:
|
66cc730 to
bc17267
Compare
remi-filament
left a comment
There was a problem hiding this comment.
Thanks @dnplkndll for your PR
| crm / res.users / target_sales_done (integer) : DEL | ||
| crm / res.users / target_sales_won (integer) : DEL | ||
|
|
||
| # DONE: crm.stage.team_id (m2o) -> team_ids (m2m) promotion handled by |
There was a problem hiding this comment.
Comments should be just after concerned lines, marking the other ones as NOTHING TO DO
There was a problem hiding this comment.
Restructured in bea32d3 — per-group markers in the work doc. # DONE only next to the m2o→m2m promotion lines (event.question.event_id / event_type_id); other lines under # NOTHING TO DO.
| def migrate(env, version): | ||
| """Populate crm.stage.team_ids m2m from legacy team_id (m2o -> m2m promotion).""" | ||
| legacy = openupgrade.get_legacy_name("team_id") | ||
| openupgrade.logged_query( |
There was a problem hiding this comment.
You have an helper method on openupgradelib doing the same m2o_to_x2m()
I do not think that you need to rename the field beforehand anyhow since they do not have the same name it should be preserved by OpenUpgrade
There was a problem hiding this comment.
Done in bea32d3 — pre-migration removed entirely. Post-migration now uses openupgrade.m2o_to_x2m(env.cr, env['crm.stage'], 'crm_stage', 'team_ids', 'team_id') against the auto-preserved team_id column. Single 5-line function.
Promote crm.stage.team_id (m2o crm.team) to team_ids (m2m). pre-migration preserves the legacy FK column via rename_columns; post-migration inserts rows into crm_stage_crm_team_rel from it. Legacy column left for database_cleanup.
bc17267 to
bea32d3
Compare
|
@remi-filament — addressed both threads in bea32d3:
Title also tightened ( |
19.0 promotes
crm.stage.team_id(m2o tocrm.team) toteam_ids(m2m). Without explicit migration the per-stage team assignment is lost (rendered as DEL old + NEW empty in the analysis). Since the new field has a different name, OpenUpgrade preserves the old column automatically — no pre-migration rename needed.openupgrade.m2o_to_x2m()reads the preservedteam_idcolumn and populatescrm_stage_crm_team_rel.Test: asserts at least one stage has
team_idspopulated post-migration.DEL fields on
crm.lead(mobile,title) andres.users(target_sales_done,target_sales_won) left todatabase_cleanupper maintainer policy.