Skip to content

[IMP] util/models: check m2m tables on model rename #278

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

Closed
wants to merge 1 commit into from

Conversation

aj-fuentes
Copy link
Contributor

When renaming a model we need to check m2m tables that may need to be
renamed as well. Otherwise the ORM will create a new table that would be
empty. If the data is handled directly in the scripts the ignore
parameter can be used to avoid warnings.

@robodoo
Copy link
Contributor

robodoo commented May 26, 2025

Pull request status dashboard

@aj-fuentes aj-fuentes requested a review from KangOl May 26, 2025 15:00
@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch 3 times, most recently from ca53be3 to edc0489 Compare May 26, 2025 15:24
Copy link
Contributor

@KangOl KangOl left a comment

Choose a reason for hiding this comment

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

First quick review.

@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch 8 times, most recently from bb4bd77 to 5113080 Compare May 27, 2025 19:53
@aj-fuentes
Copy link
Contributor Author

upgradeci retry

@aj-fuentes
Copy link
Contributor Author

upgradeci skip

@aj-fuentes
Copy link
Contributor Author

upgradeci retry with always * in versions 10.0 11.0 12.0 saas~12.3 13.0 14.0 15.0 16.0 17.0 18.0

@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch 2 times, most recently from 0b51946 to bbb6a54 Compare May 30, 2025 20:24
@aj-fuentes
Copy link
Contributor Author

upgradeci retry

@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch from bbb6a54 to 3a9aa15 Compare June 11, 2025 06:36
@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch from 3a9aa15 to 58bd009 Compare June 27, 2025 20:43
@KangOl
Copy link
Contributor

KangOl commented Jul 3, 2025

upgradeci retry with only base_sparse_field in 15.0

@aj-fuentes
Copy link
Contributor Author

upgradeci retry

@aj-fuentes
Copy link
Contributor Author

upgradeci retry with * in all versions

@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch from 58bd009 to 5e9ae34 Compare July 11, 2025 09:06
@KangOl
Copy link
Contributor

KangOl commented Jul 11, 2025

upgradeci skip
(needs a rebase of the upgrade PR)

@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch from 5e9ae34 to 1cebacf Compare July 15, 2025 14:48
@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch from 1cebacf to 8837b07 Compare July 31, 2025 14:36
@KangOl
Copy link
Contributor

KangOl commented Jul 31, 2025

The res_currency2 error come from the rename_model tests

  File "/upgrade-util/src/base/tests/test_util.py", line 625, in test_rename_model
    util.rename_model(self.cr, "res.currency", "res.currency2")

@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch 3 times, most recently from f11d163 to 9c8a2b0 Compare August 7, 2025 09:00
@aj-fuentes aj-fuentes force-pushed the master-imp_check_m2m-afu branch 6 times, most recently from d3829d2 to 7fb14dc Compare August 7, 2025 13:40
@aj-fuentes aj-fuentes requested a review from KangOl August 7, 2025 13:41
@KangOl
Copy link
Contributor

KangOl commented Aug 7, 2025

upgradeci retry with always only account account_asset account_batch_payment account_budget account_intrastat account_online_sync account_reports analytic appointment base base_automation calendar coupon crm crm_iap_lead crm_project delivery hr hr_contract_salary hr_expense hr_holidays hr_payroll hr_recruitment hr_recruitment_skills iap_extract industry_fsm industry_fsm_report l10n_au_hr_payroll l10n_be_hr_payroll l10n_be_hr_payroll_sd_worx l10n_be_reports l10n_es l10n_es_edi_facturae l10n_es_reports l10n_fr_account l10n_fr_hr_payroll l10n_lu_reports l10n_nl_reports l10n_pl l10n_pl_jpk l10n_pl_reports link_tracker loyalty lunch mail mail_group maintenance marketing_automation mass_mailing mrp mrp_account payment planning point_of_sale pos_enterprise procurement product project quality_control_worksheet repair sale sale_contract sale_loyalty sale_management sale_subscription sales_team sign stock stock_picking_batch survey timesheet_grid uom utm voip website website_blog website_contract website_event_questions worksheet

@KangOl KangOl force-pushed the master-imp_check_m2m-afu branch from 7fb14dc to 2eb97b9 Compare August 7, 2025 16:25
When renaming a model we need to check m2m tables that may need to be
renamed as well. Otherwise the ORM will create a new table that would be
empty. If the data is handled directly in the scripts the ignore
parameter can be used to avoid warnings.

Notes:
* As this is a breaking change, this only done by default from
  Odoo saas~18.1
* From Odoo 9 the column relation_table exists in ir_model_fields
* From Odoo 10 the name of m2m tables is given by the model names ordered
  alphabetically

Related: odoo/upgrade#7752
@KangOl KangOl force-pushed the master-imp_check_m2m-afu branch from 2eb97b9 to 74826f6 Compare August 7, 2025 17:45
Copy link
Contributor

@KangOl KangOl left a comment

Choose a reason for hiding this comment

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

robodoo pushed a commit that referenced this pull request Aug 8, 2025
When renaming a model we need to check m2m tables that may need to be
renamed as well. Otherwise the ORM will create a new table that would be
empty. If the data is handled directly in the scripts the ignore
parameter can be used to avoid warnings.

Notes:
* As this is a breaking change, this only done by default from
  Odoo saas~18.1
* From Odoo 9 the column relation_table exists in ir_model_fields
* From Odoo 10 the name of m2m tables is given by the model names ordered
  alphabetically

closes #278

Related: odoo/upgrade#7752
Signed-off-by: Christophe Simonis (chs) <[email protected]>
robodoo pushed a commit that referenced this pull request Aug 8, 2025
When renaming a model we need to check m2m tables that may need to be
renamed as well. Otherwise the ORM will create a new table that would be
empty. If the data is handled directly in the scripts the ignore
parameter can be used to avoid warnings.

Notes:
* As this is a breaking change, this only done by default from
  Odoo saas~18.1
* From Odoo 9 the column relation_table exists in ir_model_fields
* From Odoo 10 the name of m2m tables is given by the model names ordered
  alphabetically

closes #278

Related: odoo/upgrade#7752
Signed-off-by: Christophe Simonis (chs) <[email protected]>
@robodoo robodoo closed this in 1ff209a Aug 8, 2025
@robodoo robodoo added the 18.5 label Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants