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 intoOCA:18.0from
BinhexTeam:18.0-fix-subscription_oca-migration-script-for-product-template-subscription_template_id-field
Open

[18.0] [FIX] subscription_oca: add migration script for subscription_template_id field on product.template model #1410
rrebollo wants to merge 1 commit intoOCA:18.0from
BinhexTeam:18.0-fix-subscription_oca-migration-script-for-product-template-subscription_template_id-field

Conversation

@rrebollo
Copy link

@rrebollo rrebollo commented Mar 19, 2026

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
Copy link
Contributor

@luisDIXMIT luisDIXMIT left a comment

Choose a reason for hiding this comment

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

Code review, LGTM!

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.

2 participants