-
- Downloads
[FIX] stock_valuation_layer: add an index to stock_valuation_layer_id field to improve performance
The index is being added because when processing a large PoS session, the method consume_specific_qty is called a large number of times if the product categories are set to automatic valuations. This method has the line: tmp_value += qty_taken_on_candidate * ((candidate.value + sum(candidate.stock_valuation_layer_ids.mapped('value'))) / candidate.quantity) This line, when running upwards of 20,000 times, can cause large performance issues, due to the stock_valuation_layer_ids being a related field on stock_valuation_layer_id. This causes a doubling of the number of sql queries which causes slowdowns in performance. Adding this index drastically improves the performance of the queries generated by this line of code. opw-3295560 closes odoo/odoo#126164 X-original-commit: 6f491e34 Signed-off-by:William Henrotin (whe) <whe@odoo.com>
Please register or sign in to comment