Skip to content

[IMP] product: leverage related field for single variant products #201144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Feyensv
Copy link
Contributor

@Feyensv Feyensv commented Mar 11, 2025

See also:
odoo/enterprise#81132
odoo/upgrade#7362

Taken over from #189001


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented Mar 11, 2025

Pull request status dashboard

@Feyensv Feyensv force-pushed the master-product-related-fields-vfe branch from f878dab to 1f0247e Compare March 11, 2025 11:43
@C3POdoo C3POdoo added the RD research & development, internal work label Mar 11, 2025
@Feyensv Feyensv force-pushed the master-product-related-fields-vfe branch 2 times, most recently from 30689bb to e24bdf1 Compare March 13, 2025 13:42
@Feyensv Feyensv force-pushed the master-product-related-fields-vfe branch from e24bdf1 to 0afba6c Compare March 25, 2025 16:37
@Feyensv Feyensv force-pushed the master-product-related-fields-vfe branch 3 times, most recently from 25018b9 to 130d5d3 Compare April 4, 2025 13:50
@Feyensv
Copy link
Contributor Author

Feyensv commented Apr 4, 2025

Hello @ivantodorovich, I've updated your work to avoid storing the new field, as I didn't believe it was worth storing (and would have been a performance issue to compute on all existing templates on existing databases upgrades).
Searches on those related fields don't need the field to be stored either, do you remember why you had to store it ?
Was it for the queries on product.template where a related field was used in the order by clause ? (I removed some in the pos)

@ivantodorovich
Copy link
Contributor

Hello @Feyensv , thanks for taking over!

I stored it because then it'd make the related single variant fields groupable/aggregatable/sortable, behave almost like real fields, which I think it's nice

That PR is what actually inspired this. I wanted to leverage this improvement here.
That's the story, but I'm not against not storing it, though.

Alternatively, with perf in mind, maybe the compute method could be refactored by using a single raw SQL query instead.

@Feyensv Feyensv force-pushed the master-product-related-fields-vfe branch 3 times, most recently from 9c0e717 to 880f61f Compare May 5, 2025 13:27
ivantodorovich and others added 2 commits July 18, 2025 17:04
Related fields were recently upgraded, and it's now possible to group over them.

With that in mind, this commit refactors the way we handle template fields for
single variant products, to leverage related fields instead of computed ones.

This reduces the need for boilerplate code.

Co-authored-by: Victor Feyens <vfe@odoo.com>
@Feyensv Feyensv force-pushed the master-product-related-fields-vfe branch from 880f61f to f08087e Compare July 18, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy