Skip to content

[IMP] cow_templates_replicate_upstream: also update inherit_id - #463

Merged
pedrobaeza merged 1 commit into
OCA:masterfrom
Tecnativa:cow_templates_replicate_upstream-inherit_id
Aug 25, 2026
Merged

[IMP] cow_templates_replicate_upstream: also update inherit_id#463
pedrobaeza merged 1 commit into
OCA:masterfrom
Tecnativa:cow_templates_replicate_upstream-inherit_id

Conversation

@cristina-hidalgo-tecnativa

@cristina-hidalgo-tecnativa cristina-hidalgo-tecnativa commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

cow_templates_replicate_upstream only copies arch_db from the generic view to its COW'd copies, not inherit_id.

That's enough when a module migration only changes the content of the parent template, but not when the migration itself re-targets which template the view inherits from — the COW copy keeps the old inherit_id and view combination still fails at render time, even after arch_db is refreshed.

This showed up in a real migration: OCA/e-commerce#1295 restructures website_sale_product_attribute_filter_category's view because website_sale moved the attribute-filter loop to a different template between 18.0 and 19.0. A website that had the option toggled on in 18.0 kept crashing /shop after upgrading, because its COW copy still inherited from the old template.

The fix copies inherit_id along with arch_db, but first checks whether the new parent template itself has its own COW copy for that same website — if so, it points there instead of at the generic parent, preserving that website's own customization chain. When the parent didn't change, or there's no website-specific copy of it, it falls back to generic.inherit_id as before (no-op / same behavior as the initial version of this fix).

@Tecnativa TT64160
@pedrobaeza @pilarvargas-tecnativa

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

Wait, this is not correct at all. Maybe there's another parent specific for the website, and it should be set as the inherit. Can it be? Or am I wrong?

@pilarvargas-tecnativa

Copy link
Copy Markdown
Contributor

I think the best approach would be:

  • Get the new generic parent from generic.inherit_id.
  • Look for a COW copy of that parent for the same website_id as the view being updated.
  • If it exists, use that COW view as the new inherit_id.
  • Otherwise, fall back to the generic parent.

This way we preserve the website-specific inheritance chain instead of always pointing the COW view directly to the generic parent.

@cristina-hidalgo-tecnativa
cristina-hidalgo-tecnativa force-pushed the cow_templates_replicate_upstream-inherit_id branch from 6d2f732 to ea6e1c4 Compare August 25, 2026 05:32
@cristina-hidalgo-tecnativa

Copy link
Copy Markdown
Contributor Author

I think the best approach would be:

* Get the new generic parent from generic.inherit_id.

* Look for a COW copy of that parent for the same website_id as the view being updated.

* If it exists, use that COW view as the new inherit_id.

* Otherwise, fall back to the generic parent.

This way we preserve the website-specific inheritance chain instead of always pointing the COW view directly to the generic parent.

Exactly, that's the approach I already pushed — get the generic parent's key, look for a COW copy of it for the same website_id, use that if it exists, otherwise fall back to the generic parent.

@pedrobaeza

Copy link
Copy Markdown
Member

Now to apply these 2 methods in all the OpenUpgrade versions...

@pedrobaeza
pedrobaeza merged commit 8bc3505 into OCA:master Aug 25, 2026
16 checks passed
@pedrobaeza
pedrobaeza deleted the cow_templates_replicate_upstream-inherit_id branch August 25, 2026 07:01
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.

3 participants