1705a40a9dc5e21b995a2ea617511ef2ad356522
The function `_get_possible_combinations` generates possibles combinations for the product template attribute values (ptav) of each product template attribute line (ptal) of a given product template. It used to iterate over them using a cartesian product. A combination can be invalid if it contains two incompatibles ptav. The problem is that it used to filter out invalid combinations after generating them. It's a problem because there can be a lot of invalid combinations to filter out before finding a valid combination. Even before the first valid combination if the first ptav of the two first ptal are incompatible. The solution brought by this commit is to reject the invalid combinations while building them rather than after. It does so by using a cartesian product implementation with early rejection. The algorithm tests each ptav when incorporating it in a partial combination and if it's incompatible, it goes to the next partial combination and thus skips all combinations starting with the invalid partial combination. The client that reported the issue has a product template with about 25 ptal with an average of 9 ptav. The ptav of the first ptal was incompatible with the first ptav of second ptal. It had to build and filter out 5.76*10^15 ptav before finding the first valid ptav. If we generate 10^6 ptav by second (it's much less) user would get first ptav after 182 years. Now it's instantaneous. opw-2335936 closes odoo/odoo#65809 X-original-commit: 98616c4676aa6ef5507110c0e407a640082abbaf Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%