-
-
Notifications
You must be signed in to change notification settings - Fork 798
[19.0][MIG] base #5446
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
Merged
MiquelRForgeFlow
merged 4 commits into
OCA:19.0
from
hbrunn:19.0-initialize+openupgrade_framework+base
Feb 9, 2026
Merged
[19.0][MIG] base #5446
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
openupgrade_scripts/scripts/base/19.0.1.3/noupdate_changes_work.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <?xml version='1.0' encoding='utf-8'?> | ||
| <odoo> | ||
| <record id="AED" model="res.currency"> | ||
| <field name="symbol">AED</field> | ||
| </record> | ||
| <record id="ae" model="res.country"> | ||
| <field name="state_required">1</field> | ||
| <field name="vat_label">TRN</field> | ||
| </record> | ||
| <record id="cd" model="res.country"> | ||
| <field name="name">Congo (DRC)</field> | ||
| </record> | ||
| <record id="cg" model="res.country"> | ||
| <field name="name">Congo (Republic)</field> | ||
| </record> | ||
| <record id="ch_and_li" model="res.country.group"> | ||
| <field name="code">CH-LI</field> | ||
| </record> | ||
| <record id="eurasian_economic_union" model="res.country.group"> | ||
| <field name="code">EEU</field> | ||
| </record> | ||
| <record id="europe" model="res.country.group"> | ||
| <field name="code">EU</field> | ||
| </record> | ||
| <record id="gulf_cooperation_council" model="res.country.group"> | ||
| <field name="code">GCC</field> | ||
| </record> | ||
| <record id="ir_filters_employee_rule" model="ir.rule"> | ||
| <field name="domain_force">[('user_ids','in',[False,user.id])]</field> | ||
| <field name="name">ir.filter: owner or global</field> | ||
| <field name="perm_unlink" eval="True"/> | ||
| <field name="perm_create" eval="True"/> | ||
| <field name="perm_read" eval="True"/> | ||
| <field name="perm_write" eval="True"/> | ||
| </record> | ||
| <record id="ir_filters_portal_public_rule" model="ir.rule"> | ||
| <field name="domain_force">[('user_ids', 'in', user.ids)]</field> | ||
| </record> | ||
| <record id="partner_admin" model="res.partner"> | ||
| <field name="email"/> | ||
| </record> | ||
| <record id="pf" model="res.country"> | ||
| <field name="vat_label">VAT</field> | ||
| </record> | ||
| <record id="public_user" model="res.users"> | ||
| <field name="group_ids" eval="[Command.link(ref('base.group_public'))]"/> | ||
| </record> | ||
| <record id="sepa_zone" model="res.country.group"> | ||
| <field name="code">SEPA</field> | ||
| </record> | ||
| <record id="south_america" model="res.country.group"> | ||
| <field name="code">SA</field> | ||
| </record> | ||
| <record id="user_admin" model="res.users"> | ||
| <!-- don't touch admin's fields | ||
| <field name="signature" type="html"> | ||
| <div>Administrator</div> | ||
| </field> | ||
| <field name="group_ids" eval="[Command.set([])]"/> | ||
| --> | ||
| </record> | ||
| <record id="user_root" model="res.users"> | ||
| <!-- don't touch root's fields | ||
| <field name="signature" type="html"> | ||
| <div>System</div> | ||
| </field> | ||
| --> | ||
| </record> | ||
| </odoo> |
111 changes: 111 additions & 0 deletions
111
openupgrade_scripts/scripts/base/19.0.1.3/post-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| # Copyright 2025 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| from odoo.fields import Command | ||
|
|
||
|
|
||
| def _ir_actions_act_window_target(env): | ||
| """ | ||
| selection value 'inline' was removed, map to 'current' | ||
| """ | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| "UPDATE ir_act_window SET target='current' WHERE target='inline'", | ||
| ) | ||
|
|
||
|
|
||
| def _ir_actions_server_child_ids(env): | ||
| """ | ||
| Field was changed from m2m to o2m - set parent_id from m2m table, | ||
| duplicate child actions that had multiple parents | ||
| """ | ||
| env.cr.execute( | ||
| """ | ||
| SELECT action_id, array_agg(server_id) | ||
| FROM rel_server_actions GROUP BY action_id | ||
| """ | ||
| ) | ||
| for action_id, parent_ids in env.cr.fetchall(): | ||
| action = env["ir.actions.server"].browse(action_id) | ||
| parents = env["ir.actions.server"].browse(parent_ids) | ||
| action.parent_id = parents[0] | ||
| for parent in parents[1:]: | ||
| action.copy({"name": action.name, "parent_id": parent.id}) | ||
|
|
||
|
|
||
| def _ir_actions_server_html_value(env): | ||
| """ | ||
| For evaluation_type 'value' and update_field_id.ttype == 'html', | ||
| new field html_value is used | ||
| """ | ||
| for action in env["ir.actions.server"].search( | ||
| [ | ||
| ("state", "=", "object_write"), | ||
| ("evaluation_type", "=", "value"), | ||
| ("update_field_id.ttype", "=", "html"), | ||
| ] | ||
| ): | ||
| action.write({"html_value": action.value}) | ||
|
|
||
|
|
||
| def _ir_filters_user_ids(env): | ||
| """ | ||
| m2o user_id has been transformed to m2m user_ids | ||
| """ | ||
| openupgrade.m2o_to_x2m( | ||
| env.cr, env["ir.filters"], env["ir.filters"]._table, "user_ids", "user_id" | ||
| ) | ||
|
|
||
|
|
||
| def _res_lang(env): | ||
| """ | ||
| Char fields date_format, grouping and time_format have been dumbed down to | ||
| selection fields. Keep their original value in a legacy column, and map existing | ||
| values not in the selection to the default value | ||
| """ | ||
| ResLang = env["res.lang"] | ||
| for field_name in ("date_format", "time_format", "grouping"): | ||
| field = ResLang._fields[field_name] | ||
| openupgrade.copy_columns(env.cr, {"res_lang": [(field_name, None, None)]}) | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| f"UPDATE res_lang SET {field_name}=%(default)s " | ||
| f"WHERE {field_name} NOT IN %(selection)s", | ||
| { | ||
| "default": field.default(ResLang), | ||
| "selection": tuple( | ||
| value for value, _string in field._description_selection(env) | ||
| ), | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| def _init_default_user_group(env): | ||
| """ | ||
| Assign all groups of default_user to implied_ids of default_user_group | ||
| """ | ||
| default_user = env.ref("base.default_user", raise_if_not_found=False) | ||
| if not default_user: | ||
| return | ||
| env.ref("base.default_user_group").write( | ||
| { | ||
| "implied_ids": [Command.set(default_user.group_ids.ids)], | ||
| } | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.load_data(env, "base", "19.0.1.3/noupdate_changes_work.xml") | ||
| openupgrade.delete_records_safely_by_xml_id( | ||
| env, | ||
| ["base.ir_filters_delete_own_rule", "base.default_user"], | ||
| ) | ||
| _ir_actions_act_window_target(env) | ||
| _ir_actions_server_child_ids(env) | ||
| _ir_actions_server_html_value(env) | ||
| _ir_filters_user_ids(env) | ||
| _res_lang(env) | ||
| _init_default_user_group(env) | ||
178 changes: 178 additions & 0 deletions
178
openupgrade_scripts/scripts/base/19.0.1.3/pre-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| # Copyright 2025 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| # pylint: disable=odoo-addons-relative-import | ||
| from odoo.addons.openupgrade_scripts.apriori import merged_modules, renamed_modules | ||
|
|
||
| _renamed_xmlids = [ | ||
| ("l10n_fr.dom-tom", "base.dom-tom"), | ||
| ("l10n_at.state_at_1", "base.state_at_1"), | ||
| ("l10n_at.state_at_2", "base.state_at_2"), | ||
| ("l10n_at.state_at_3", "base.state_at_3"), | ||
| ("l10n_at.state_at_4", "base.state_at_4"), | ||
| ("l10n_at.state_at_5", "base.state_at_5"), | ||
| ("l10n_at.state_at_6", "base.state_at_6"), | ||
| ("l10n_at.state_at_7", "base.state_at_7"), | ||
| ("l10n_at.state_at_8", "base.state_at_8"), | ||
| ("l10n_at.state_at_9", "base.state_at_9"), | ||
| ("l10n_bd.state_bd_a", "base.state_bd_a"), | ||
| ("l10n_bd.state_bd_b", "base.state_bd_b"), | ||
| ("l10n_bd.state_bd_c", "base.state_bd_c"), | ||
| ("l10n_bd.state_bd_d", "base.state_bd_d"), | ||
| ("l10n_bd.state_bd_e", "base.state_bd_e"), | ||
| ("l10n_bd.state_bd_f", "base.state_bd_f"), | ||
| ("l10n_bd.state_bd_g", "base.state_bd_g"), | ||
| ("l10n_bd.state_bd_h", "base.state_bd_h"), | ||
| ("base.state_id_pp", "base.state_id_pe"), | ||
| ("l10n_iq.state_iq_01", "base.state_iq_01"), | ||
| ("l10n_iq.state_iq_01_ar", "base.state_iq_01_ar"), | ||
| ("l10n_iq.state_iq_02", "base.state_iq_02"), | ||
| ("l10n_iq.state_iq_02_ar", "base.state_iq_02_ar"), | ||
| ("l10n_iq.state_iq_03", "base.state_iq_03"), | ||
| ("l10n_iq.state_iq_03_ar", "base.state_iq_03_ar"), | ||
| ("l10n_iq.state_iq_04", "base.state_iq_04"), | ||
| ("l10n_iq.state_iq_04_ar", "base.state_iq_04_ar"), | ||
| ("l10n_iq.state_iq_05", "base.state_iq_05"), | ||
| ("l10n_iq.state_iq_05_ar", "base.state_iq_05_ar"), | ||
| ("l10n_iq.state_iq_06", "base.state_iq_06"), | ||
| ("l10n_iq.state_iq_06_ar", "base.state_iq_06_ar"), | ||
| ("l10n_iq.state_iq_07", "base.state_iq_07"), | ||
| ("l10n_iq.state_iq_07_ar", "base.state_iq_07_ar"), | ||
| ("l10n_iq.state_iq_08", "base.state_iq_08"), | ||
| ("l10n_iq.state_iq_08_ar", "base.state_iq_08_ar"), | ||
| ("l10n_iq.state_iq_09", "base.state_iq_09"), | ||
| ("l10n_iq.state_iq_09_ar", "base.state_iq_09_ar"), | ||
| ("l10n_iq.state_iq_10", "base.state_iq_10"), | ||
| ("l10n_iq.state_iq_10_ar", "base.state_iq_10_ar"), | ||
| ("l10n_iq.state_iq_11", "base.state_iq_11"), | ||
| ("l10n_iq.state_iq_11_ar", "base.state_iq_11_ar"), | ||
| ("l10n_iq.state_iq_12", "base.state_iq_12"), | ||
| ("l10n_iq.state_iq_12_ar", "base.state_iq_12_ar"), | ||
| ("l10n_iq.state_iq_13", "base.state_iq_13"), | ||
| ("l10n_iq.state_iq_13_ar", "base.state_iq_13_ar"), | ||
| ("l10n_iq.state_iq_14", "base.state_iq_14"), | ||
| ("l10n_iq.state_iq_14_ar", "base.state_iq_14_ar"), | ||
| ("l10n_iq.state_iq_15", "base.state_iq_15"), | ||
| ("l10n_iq.state_iq_15_ar", "base.state_iq_15_ar"), | ||
| ("l10n_iq.state_iq_16", "base.state_iq_16"), | ||
| ("l10n_iq.state_iq_16_ar", "base.state_iq_16_ar"), | ||
| ("l10n_iq.state_iq_17", "base.state_iq_17"), | ||
| ("l10n_iq.state_iq_17_ar", "base.state_iq_17_ar"), | ||
| ("l10n_iq.state_iq_18", "base.state_iq_18"), | ||
| ("l10n_iq.state_iq_18_ar", "base.state_iq_18_ar"), | ||
| ("l10n_pk.state_pk_ajk", "base.state_pk_ajk"), | ||
| ("l10n_pk.state_pk_ba", "base.state_pk_ba"), | ||
| ("l10n_pk.state_pk_gb", "base.state_pk_gb"), | ||
| ("l10n_pk.state_pk_is", "base.state_pk_is"), | ||
| ("l10n_pk.state_pk_kp", "base.state_pk_kp"), | ||
| ("l10n_pk.state_pk_pb", "base.state_pk_pb"), | ||
| ("l10n_pk.state_pk_sd", "base.state_pk_sd"), | ||
| ("l10n_pl.state_pl_ds", "base.state_pl_ds"), | ||
| ("l10n_pl.state_pl_kp", "base.state_pl_kp"), | ||
| ("l10n_pl.state_pl_lb", "base.state_pl_lb"), | ||
| ("l10n_pl.state_pl_ld", "base.state_pl_ld"), | ||
| ("l10n_pl.state_pl_ls", "base.state_pl_ls"), | ||
| ("l10n_pl.state_pl_mp", "base.state_pl_mp"), | ||
| ("l10n_pl.state_pl_mz", "base.state_pl_mz"), | ||
| ("l10n_pl.state_pl_op", "base.state_pl_op"), | ||
| ("l10n_pl.state_pl_pk", "base.state_pl_pk"), | ||
| ("l10n_pl.state_pl_pl", "base.state_pl_pl"), | ||
| ("l10n_pl.state_pl_pm", "base.state_pl_pm"), | ||
| ("l10n_pl.state_pl_sk", "base.state_pl_sk"), | ||
| ("l10n_pl.state_pl_sl", "base.state_pl_sl"), | ||
| ("l10n_pl.state_pl_wm", "base.state_pl_wm"), | ||
| ("l10n_pl.state_pl_wp", "base.state_pl_wp"), | ||
| ("l10n_pl.state_pl_zp", "base.state_pl_zp"), | ||
| ("l10n_tw.state_tw_chh", "base.state_tw_chh"), | ||
| ("l10n_tw.state_tw_cic", "base.state_tw_cic"), | ||
| ("l10n_tw.state_tw_cih", "base.state_tw_cih"), | ||
| ("l10n_tw.state_tw_hch", "base.state_tw_hch"), | ||
| ("l10n_tw.state_tw_hct", "base.state_tw_hct"), | ||
| ("l10n_tw.state_tw_hlh", "base.state_tw_hlh"), | ||
| ("l10n_tw.state_tw_ilh", "base.state_tw_ilh"), | ||
| ("l10n_tw.state_tw_khc", "base.state_tw_khc"), | ||
| ("l10n_tw.state_tw_klc", "base.state_tw_klc"), | ||
| ("l10n_tw.state_tw_kmc", "base.state_tw_kmc"), | ||
| ("l10n_tw.state_tw_lcc", "base.state_tw_lcc"), | ||
| ("l10n_tw.state_tw_mlh", "base.state_tw_mlh"), | ||
| ("l10n_tw.state_tw_ntc", "base.state_tw_ntc"), | ||
| ("l10n_tw.state_tw_ntpc", "base.state_tw_ntpc"), | ||
| ("l10n_tw.state_tw_phc", "base.state_tw_phc"), | ||
| ("l10n_tw.state_tw_pth", "base.state_tw_pth"), | ||
| ("l10n_tw.state_tw_tcc", "base.state_tw_tcc"), | ||
| ("l10n_tw.state_tw_tnh", "base.state_tw_tnh"), | ||
| ("l10n_tw.state_tw_tpc", "base.state_tw_tpc"), | ||
| ("l10n_tw.state_tw_tth", "base.state_tw_tth"), | ||
| ("l10n_tw.state_tw_tyc", "base.state_tw_tyc"), | ||
| ("l10n_tw.state_tw_ylh", "base.state_tw_ylh"), | ||
| ] | ||
|
|
||
| _merged_xmlids = [ | ||
| ("base.module_category_inventory", "base.module_category_supply_chain"), | ||
| ("base.module_category_manufacturing", "base.module_category_supply_chain"), | ||
| ] | ||
|
|
||
| _renamed_fields = [ | ||
| ( | ||
| "ir.actions.act_window", | ||
| "ir_act_window", | ||
| "groups_id", | ||
| "group_ids", | ||
| ), | ||
| ( | ||
| "ir.actions.report", | ||
| "ir_act_report_xml", | ||
| "groups_id", | ||
| "group_ids", | ||
| ), | ||
| ( | ||
| "ir.actions.server", | ||
| "ir_act_report_xml", | ||
| "groups_id", | ||
| "group_ids", | ||
| ), | ||
| ( | ||
| "ir.ui.menu", | ||
| "ir_ui_menu", | ||
| "groups_id", | ||
| "group_ids", | ||
| ), | ||
| ( | ||
| "ir.ui.view", | ||
| "ir_ui_view", | ||
| "groups_id", | ||
| "group_ids", | ||
| ), | ||
| ( | ||
| "res.groups", | ||
| "res_groups", | ||
| "users", | ||
| "user_ids", | ||
| ), | ||
| ( | ||
| "res.users", | ||
| "res_users", | ||
| "groups_id", | ||
| "group_ids", | ||
| ), | ||
| ] | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| f""" | ||
| CREATE TABLE { | ||
| openupgrade.get_legacy_name("ir_module_module") | ||
| } AS (SELECT name, state FROM ir_module_module); | ||
| """, | ||
| ) | ||
| openupgrade.update_module_names(env.cr, renamed_modules.items()) | ||
| openupgrade.update_module_names(env.cr, merged_modules.items(), merge_modules=True) | ||
| openupgrade.clean_transient_models(env.cr) | ||
| openupgrade.rename_xmlids(env.cr, _renamed_xmlids) | ||
| openupgrade.rename_xmlids(env.cr, _merged_xmlids, allow_merge=True) | ||
| openupgrade.rename_fields(env, _renamed_fields) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.