Skip to content

[OU-FIX] base: create missing cron server action XML IDs - #6057

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
Tecnativa:18.0-ou-fix-base-cron_parent_xmlids
Oct 27, 2026
Merged

OCA-git-bot merged 1 commit into
OCA:18.0from
Tecnativa:18.0-ou-fix-base-cron_parent_xmlids

Conversation

@sergio-teruel

@sergio-teruel sergio-teruel commented Oct 16, 2026 •

Copy link
Copy Markdown

When a record with an XML ID is created, Odoo also creates the XML ID <xmlid>_<parent model> of its _inherits parent, but crons created by old versions lack the one of their server action. This happens on databases started in 10.0 or earlier, whose crons got their server action in the 11.0 migration.

18.0 is the first version whose data references them (stock.ir_cron_scheduler_action_ir_actions_server in the stock and mrp procurement menus), so updating stock fails with "External ID not found in the system: stock.ir_cron_scheduler_action_ir_actions_server".

Reloading the cron data can't fix it, as the parent XML ID is only added when the record is created, not when an existing one is updated, so the missing XML IDs are added from the cron ones with add_xmlid.

@Tecnativa

ping @carlosdauden @carlos-lopez-tecnativa @CarlosRoca13

@OCA-git-bot OCA-git-bot added mod:openupgrade_scripts Module openupgrade_scripts series:18.0 labels Oct 16, 2026

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

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.

Just out of curiosity, from which Odoo version did you migrate? I reviewed a database created in v13, and it already has the XML IDs for ir.cron and ir.actions.server, so I'm not sure whether this code should target a lower branch.

@sergio-teruel

Copy link
Copy Markdown
Author

Good point!!.
The database was created in 10.0 (June 2017). Crons only inherit from ir.actions.server since 11.0, and the 11.0 base migration creates the server actions of the existing crons with a plain INSERT (fill_cron_action_server_post), so they never got the _ir_actions_server XML ID.
In my database exactly the 11 crons created between 2017-06 and 2018-11 lack it, while the ones created later have it, so a database created in 13.0 isn't affected.

I'd still keep the fix in 18.0: 18.0 is the first version whose data references these XML IDs (the stock and mrp procurement menus), so the missing ones are harmless before, and fixing it in 11.0 wouldn't help databases that already went through it.

@sergio-teruel

Copy link
Copy Markdown
Author

I have updated de PR description

@hbrunn hbrunn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

as this is a quite generic problem, I'd like to see a function in openupgradelib that handles this in a generic way

When a record with an XML ID is created, Odoo also creates the XML ID `<xmlid>_<parent model>` of its `_inherits` parent, but crons created by old versions lack the one of their server action. This happens on databases started in 10.0 or earlier, whose crons got their server action in the 11.0 migration. 18.0 is the first version whose data references them (stock.ir_cron_scheduler_action_ir_actions_server in the stock and mrp procurement menus), so updating stock fails with "External ID not found in the system". They are added with the generic openupgradelib add_inherits_parent_xmlids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sergio-teruel

sergio-teruel commented Oct 20, 2026 •

Copy link
Copy Markdown
Author

PR to openupgradelib done: OCA/openupgradelib#476
After merge it I will change this PR to use the method

@sergio-teruel
sergio-teruel force-pushed the 18.0-ou-fix-base-cron_parent_xmlids branch from e5a1d05 to 591f248 Compare October 27, 2026 16:01
@sergio-teruel

Copy link
Copy Markdown
Author

This PR (OCA/openupgradelib#476) has been merged so now we can use the method add_inherits_parent_xmlids.

PR updated

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

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.

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-6057-by-carlos-lopez-tecnativa-bump-nobump, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@OCA-git-bot
OCA-git-bot merged commit a393ddb into OCA:18.0 Oct 27, 2026
4 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at a393ddb. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants