Skip to content

[18.0] [FIX] subscription_oca: add migration script for subscription_template_id field on product.template model - #1410

Open
rrebollo wants to merge 1 commit into
OCA:18.0from
BinhexTeam:18.0-fix-subscription_oca-migration-script-for-product-template-subscription_template_id-field
Open

rrebollo wants to merge 1 commit into
OCA:18.0from
BinhexTeam:18.0-fix-subscription_oca-migration-script-for-product-template-subscription_template_id-field

Conversation

@rrebollo

@rrebollo rrebollo commented Mar 19, 2026

Copy link
Copy Markdown

Context

We discovered this issue during a customer migration from v14 to v18: the subscription_template_id field value for product templates is lost after upgrading to v18.

Root Cause

#1060 made subscription_template_id a company-dependent field on product.template, but this change was never forward-ported beyond its target version (v14).

In Odoo 18.0, company-dependent fields are stored in a JSONB column instead of ir_property records. Since the forward-port never happened, the automatic migration from ir_property to JSONB did not occur, leaving the field empty after upgrade.

Solution

This pull request adds a pre-migration script for Odoo 18.0 that backfills product_template.subscription_template_id from legacy ir_property records, ensuring existing data is preserved during the upgrade.

Scope

This fix applies in a way that only instances affected by the company-dependent implementation of the subscription_template_id field will be targeted. Nothing changes or backfires if you're not affected.

Migration and Data Integrity

  • Added pre-migration.py to backfill product_template.subscription_template_id from legacy ir_property records
  • Documented the root cause and provided context about the storage change for company-dependent fields

@rrebollo rrebollo changed the title [FIX] subscription_oca: add migration script for subscription_template_id field on product.template model [18.0] [FIX] subscription_oca: add migration script for subscription_template_id field on product.template model Mar 19, 2026
@rrebollo
rrebollo marked this pull request as ready for review March 19, 2026 16:20

@luisDIXMIT luisDIXMIT 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.

Code review, LGTM!

@cvinh cvinh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM code review no test

@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). 🤖

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Sep 6, 2026
@rrebollo
rrebollo force-pushed the 18.0-fix-subscription_oca-migration-script-for-product-template-subscription_template_id-field branch from e60efbf to 88584f7 Compare September 7, 2026 14:27
@OCA-git-bot OCA-git-bot added series:18.0 mod:subscription_oca Module subscription_oca labels Sep 7, 2026
@rrebollo

rrebollo commented Sep 7, 2026

Copy link
Copy Markdown
Author

@pedrobaeza any chances to get this merged?

@pedrobaeza

Copy link
Copy Markdown
Member

Maintainers of this modules should trigger it, as I don't use (and you know that I don't want this duality contract/subscription_oca.

@rrebollo

rrebollo commented Sep 7, 2026

Copy link
Copy Markdown
Author

@rousseldenis @sbejaoui would you merge this one?

@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Sep 13, 2026
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.

5 participants