odoo/odoo#162085

Created by Aurélien van Delft (avd)
Merged at 5f2f58849d486b5e42fa5d089633f36a5dab0009

Statuses:

Linked pull requests
label
odoo-dev:master-opw-3861530-avd
head
2acbb9c57a31f37fef869421af0c013e9580d1d3
merged
1 year ago by Logistics, Quentin Wolfs (quwo)
odoo/odoo odoo/upgrade
master #162085 #5928

[FIX] stock: set product_category_name as non-stored

Currently stock_move_line.product_category_name is a stored related field relating to product_id.categ_id.complete_name. Because product.category.complete_name is itself a computed-stored field that depends on parent_id.complete_name, changing the parent_id of a given product_category categ_id triggers the recomputation of categ_id.complete_name which triggers the recomputation of stock_move_line.product_category_name. In the case where there are lots of stock_move_lines for the same product_category this can lead to slowdowns or even MemoryErrors when the recomputation happens for 1M smls.

This commit set product_category_name as stored=False. The only reason why it was stored in the first place was to allow users to group by category name from the webui (in Kanban, List and Pivot). It's not required to store related fields for that since #127353 (except if they are explicitly mark as compute_sudo=False, which is not the case here).

This removes the need to retrigger the computation of stock_move_line.product_category_name when changing the categ_id.parent_id.

opw-3861530


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