Skip to content

[18.0] [FIX] subscription_oca: prevent CRM tag context pollution on subscription create#1420

Open
rrebollo wants to merge 1 commit into
OCA:18.0from
BinhexTeam:18.0-fix-subscription_oca-crm-tag-context-pollution
Open

[18.0] [FIX] subscription_oca: prevent CRM tag context pollution on subscription create#1420
rrebollo wants to merge 1 commit into
OCA:18.0from
BinhexTeam:18.0-fix-subscription_oca-crm-tag-context-pollution

Conversation

@rrebollo
Copy link
Copy Markdown

When confirming a sale.order from a CRM opportunity, sale_crm injects default_tag_ids (containing crm.tag IDs) into the context. Without this fix, those IDs are applied by default_get() to sale.subscription.tag_ids, causing a FK constraint violation on sale_subscription_sale_subscription_tag_rel.

Fix: use clean_context() from odoo.tools to strip all default_* keys from context before calling sale.subscription.create(), following the idiomatic Odoo core pattern used in res_bank, account_move, hr_expense_sheet, etc.

Adds a regression test that reproduces the production scenario end-to-end.

@BinhexTeam T18387

…tion create

When confirming a sale.order from a CRM opportunity, sale_crm injects
default_tag_ids (containing crm.tag IDs) into the context. Without this fix,
those IDs are applied by default_get() to sale.subscription.tag_ids, causing
a FK constraint violation on sale_subscription_sale_subscription_tag_rel.

Fix: use clean_context() from odoo.tools to strip all default_* keys from
context before calling sale.subscription.create(), following the idiomatic
Odoo core pattern used in res_bank, account_move, hr_expense_sheet, etc.

Adds a regression test that reproduces the production scenario end-to-end.
@rrebollo rrebollo changed the title [FIX] subscription_oca: prevent CRM tag context pollution on subscription create [18.0] [FIX] subscription_oca: prevent CRM tag context pollution on subscription create Apr 27, 2026
@rrebollo rrebollo marked this pull request as ready for review May 6, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants