-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[14.0] [IMP] sale_order_product_assortment: Use original product_id field keeping domain. Use cache to performance #3135
Conversation
Hi @CarlosRoca13, |
1af62da
to
6af2ed5
Compare
02bc6d2
to
6af2ed5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional ok, good for merge once depending PR is merged
6af2ed5
to
4a4e019
Compare
@CarlosRoca13 what do you think? We had to apply the latest commit as the behavior was inconsistent, eg: Create assortment "Chair", product allowed: "Office Chair", partner: Azure Interior Create assortment "Chair", allowed product domain: "Name contains Office Chair", partner: Azure Interior We'll fw-port this commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review, LGTM.
I think it makes more sense and is more intuitive for the user to have different assortments linked with OR than with AND. Otherwise the effect is that, as you add more assortments to the customer, you actually shrink the selection they have available.
This PR has the |
Makes sense. Can you please add in the commit a brief explanation and the steps to reproduce the problem? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought... Let's imagine that we have 2 assortments for the same customer, in these two assortments, what is done, is to ban the purchase of chairs in the first one and tables in the second one. With this change, the customer will be able to see all the products, both chairs and tables.
@CarlosRoca13 yours is a valid point, but it seems like this is a short blanket situation, as some assortments will be used to exclude products and others to include them and some to do both - there is no right or wrong. We will look into a solution for the matter, do you have any idea how this could be solved? |
Right now, I don't know how this could be faced... But I know that we have customers who are using the assortments excluding products and we cannot assume this change... @pedrobaeza @carlosdauden @sergio-teruel can you give your point of view about this? |
There shouldn't be any feature regression. It's OK to optimize, but not losing features. |
We're on the same page on that (we've always been), but we need to address the inconsistency in the example I posted above:
Also note that website assortment module works with OR as per OCA/e-commerce#838 |
Are you telling that previously it was not correct? I agree then to cover the case correctly with the optimization. |
The real problem of this is that we are taking all assortment domain at this point: I think the right solution would be to take 2 product domains out of the assortment. One for excluded products and one for included products. In this way we could combine them in the way that suits us. Note: The excluded products can't fit with the included with OR in the domain |
Sounds like something we could think about!
@CarlosRoca13 Can you expand on this? |
4 sure, what I mean is that the excluded domain needs to be set with AND because it is restrictive, an excluded product discards any posible included product |
At the end, both should combine to get a unique domain for the product selection, but include part should be treated on one part, joining all the inclusions together, and exclusions should be also joined, and excluded from the remaining result. |
a38f294
to
a325ee0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review seems ok, I definitely prefer this solution (add all whitelisted products, remove all blacklisted products) but I think we should add a couple of tests here to make sure.
Also, outside of this PR, the logic should be unified and moved to the base module so that there are no differences with the e-commerce module.
3f06469
to
6042550
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review, LGTM
6042550
to
a305663
Compare
This PR has the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Please fw-port changes to 15.0 but note that a domain has been introduced for excluded products.
…et_all_partner_ids cached method
9751a63
to
e5621a2
Compare
/ocabot merge major |
On my way to merge this fine PR! |
Congratulations, your PR was merged at e40ff5e. Thanks a lot for contributing to OCA. ❤️ |
Back port of #2538
Depends on:
Edit: I've also added a commit that changes the AND in the
_compute_product_assortment_ids
into an OR since, in my opinion, it's more likely what an user would expect by combining more assortments