sale-workflow icon indicating copy to clipboard operation
sale-workflow copied to clipboard

[14.0] [IMP] sale_order_product_assortment: Use original product_id field keeping domain. Use cache to performance

Open renda-dev opened this issue 1 year ago • 1 comments

Back port of https://github.com/OCA/sale-workflow/pull/2538

Depends on:

  • [x] https://github.com/OCA/server-tools/pull/2941
  • [x] https://github.com/OCA/server-tools/pull/2942

renda-dev avatar May 14 '24 09:05 renda-dev

Hi @CarlosRoca13, some modules you are maintaining are being modified, check this out!

OCA-git-bot avatar May 14 '24 09:05 OCA-git-bot

@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 "Screen", product allowed: "Acoustic bloc screens", partner: Azure Interior SO for Azure Interior: 2 products can be selected

Create assortment "Chair", allowed product domain: "Name contains Office Chair", partner: Azure Interior Create assortment "Screen", allowed product domain: "Name contains Acoustic bloc screens", partner: Azure Interior SO for Azure Interior: no products can be selected

We'll fw-port this commit

francesco-ooops avatar May 22 '24 13:05 francesco-ooops

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot avatar May 22 '24 15:05 OCA-git-bot

Makes sense. Can you please add in the commit a brief explanation and the steps to reproduce the problem?

CarlosRoca13 avatar May 23 '24 05:05 CarlosRoca13

@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?

francesco-ooops avatar May 23 '24 08:05 francesco-ooops

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?

CarlosRoca13 avatar May 23 '24 08:05 CarlosRoca13

There shouldn't be any feature regression. It's OK to optimize, but not losing features.

pedrobaeza avatar May 23 '24 09:05 pedrobaeza

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:

Create assortment "Chair", product allowed: "Office Chair", partner: Azure Interior Create assortment "Screen", product allowed: "Acoustic bloc screens", partner: Azure Interior SO for Azure Interior: 2 products can be selected

Create assortment "Chair", allowed product domain: "Name contains Office Chair", partner: Azure Interior Create assortment "Screen", allowed product domain: "Name contains Acoustic bloc screens", partner: Azure Interior SO for Azure Interior: no products can be selected

Also note that website assortment module works with OR as per https://github.com/OCA/e-commerce/pull/838

francesco-ooops avatar May 23 '24 09:05 francesco-ooops

Are you telling that previously it was not correct? I agree then to cover the case correctly with the optimization.

pedrobaeza avatar May 23 '24 09:05 pedrobaeza

The real problem of this is that we are taking all assortment domain at this point: https://github.com/OCA/sale-workflow/pull/3135/commits/7e8b7a484f85ed4fb4be881b95ac8ea9dc4f921c#diff-d857107550de88517b0f4cb32ae7770a25a630dc254b97191e7f71f262183089R36 Since we don't know what type of assortment is involved

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

CarlosRoca13 avatar May 23 '24 10:05 CarlosRoca13

Sounds like something we could think about!

Note: The excluded products can't fit with the included with OR in the domain

@CarlosRoca13 Can you expand on this?

francesco-ooops avatar May 23 '24 12:05 francesco-ooops

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

CarlosRoca13 avatar May 23 '24 13:05 CarlosRoca13

@CarlosRoca13 @pedrobaeza

Ok so the idea is to have in each assortment one "inclusive" domain working with OR and an "exclusive" domain working with AND, is that correct?

Maybe for user clarity we can specify below the domains the logic that will be applied, would that work?

francesco-ooops avatar May 23 '24 13:05 francesco-ooops

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.

pedrobaeza avatar May 23 '24 13:05 pedrobaeza

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot avatar May 31 '24 21:05 OCA-git-bot

/ocabot merge major

pedrobaeza avatar Jun 03 '24 07:06 pedrobaeza

On my way to merge this fine PR! Prepared branch 14.0-ocabot-merge-pr-3135-by-pedrobaeza-bump-major, awaiting test results.

OCA-git-bot avatar Jun 03 '24 07:06 OCA-git-bot

Congratulations, your PR was merged at e40ff5e270c99945ca1638fee8df7e282d7e5d16. Thanks a lot for contributing to OCA. ❤️

OCA-git-bot avatar Jun 03 '24 07:06 OCA-git-bot