Skip to content

[IMP] util/modules: add xmlid_mapping param to merge_module#463

Open
apan-odoo wants to merge 1 commit into
odoo:masterfrom
odoo-dev:master-add_xml_mapping-apan
Open

[IMP] util/modules: add xmlid_mapping param to merge_module#463
apan-odoo wants to merge 1 commit into
odoo:masterfrom
odoo-dev:master-add_xml_mapping-apan

Conversation

@apan-odoo

Copy link
Copy Markdown
Contributor

Add an optional xmlid_mapping param to rename specific XMLIDs during a module rename/merge, before the rest of the bulk move happens.

@robodoo

robodoo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Pull request status dashboard

@apan-odoo

Copy link
Copy Markdown
Contributor Author

Example usage:

util.merge_module(
    cr,
    "l10n_ar_stock_batch",
    "l10n_ar_stock",
    xmlid_mapping={
        "action_generate_delivery_guide": "action_generate_delivery_guide_for_batch",
    },
)

@apan-odoo apan-odoo force-pushed the master-add_xml_mapping-apan branch from 393fb58 to f755b3a Compare July 10, 2026 13:14
@KangOl

KangOl commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

upgradeci retry with always only base

@apan-odoo apan-odoo force-pushed the master-add_xml_mapping-apan branch from f755b3a to af0606e Compare July 10, 2026 13:18
@KangOl

KangOl commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Modifying rename_module is not needed.
It's only relevant for merge_module to handle the conflicts.

I would also verify that the mapping doesn't contain fully-qualified xmlids, like for the keep argument of move_model.

@apan-odoo apan-odoo force-pushed the master-add_xml_mapping-apan branch from af0606e to 9bef7bc Compare July 10, 2026 13:30
@apan-odoo

Copy link
Copy Markdown
Contributor Author

Modifying rename_module is not needed. It's only relevant for merge_module to handle the conflicts.

Considered rename_module as discussed on Discord. Anyway, I removed it as suggested. Thanks!

@apan-odoo apan-odoo changed the title [IMP] util/modules: add xmlid_mapping param to rename/merge module [IMP] util/modules: add xmlid_mapping param to merge_module Jul 10, 2026
Comment thread src/util/modules.py Outdated
Comment thread src/util/modules.py Outdated
@apan-odoo apan-odoo force-pushed the master-add_xml_mapping-apan branch from 9bef7bc to 7acf5a8 Compare July 10, 2026 14:07
@KangOl

KangOl commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Can you please rebase?

Comment thread src/util/modules.py Outdated
Comment thread src/util/modules.py Outdated
Comment on lines +454 to +459
present in `into` (the warning above), even though they
refer to unrelated records; without this, that XMLID's
record would simply be deleted rather than merged. Each
pair is moved via :func:`rename_xmlid` before the general
data-merge query runs, so it's excluded from the
collision check and survives the merge under its new name.

@aj-fuentes aj-fuentes Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Too verbose. Too many implementation details.

Suggested change
present in `into` (the warning above), even though they
refer to unrelated records; without this, that XMLID's
record would simply be deleted rather than merged. Each
pair is moved via :func:`rename_xmlid` before the general
data-merge query runs, so it's excluded from the
collision check and survives the merge under its new name.
present in `into`.
See :func:`~odoo.upgrade.util.records.rename_xmlid`

Cross file func references don't work unless fully qualified

Image

Comment thread src/util/modules.py Outdated
Add an optional `xmlid_mapping` param to rename specific XMLIDs during a
module merge, before the rest of the bulk move happens.
@apan-odoo apan-odoo force-pushed the master-add_xml_mapping-apan branch from 7acf5a8 to 5ab8299 Compare July 10, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants