Name: [FIX] stock_account: let a product without stock change category without valuation access

State: Succeed finished in 209m

PR State: open

PR Author: Roy Le

PR Author Email:

PR: #1289

Committer: Roy Le

Committer Email: roy.le@viindoo.com

Commit: b1a5ec123b0a13347f66794a0e79766afab44774

Description:

                                            [FIX] stock_account: let a product without stock change category without
valuation access

Changing the category of a product to one with another cost method or
valuation empties and replenishes its valuation layers. Since
61782d7163be ("[PERF] stock_account: prevent MemoryError in
_svl_empty_stock"), `_svl_empty_stock()` reads `stock.valuation.layer`
up front for every impacted product to collect the lots of lot-valuated
ones, even when no product holds any stock. Users allowed to edit
products but not Inventory/Administrator (every other manager group)
therefore got "You are not allowed to access 'Stock Valuation Layer'"
right after creating a product and changing its category.

Return early when no impacted product holds stock, and only collect lots
of lot-valuated products holding stock, the only ones whose lots are
used. A product with stock still creates layers, and that stays refused
for those users, exactly as before.
                                            

Branch: 18.0

Age:

Up-time:

Subbuilds Name State Detail
Build 418232 At install tests: from account to website_sms 133m Succeed Log
Build 418233 Post install tests: step install all modules 62m Succeed Log
Build 418234 Post install tests: from account to hr_recruitment_survey 128m Succeed Log
Build 418235 Post install tests: from hr_skills to phone_validation 115m Succeed Log
Build 418236 Post install tests: from point_of_sale to purchase_requisition_stock 115m Succeed Log
Build 418237 Post install tests: from purchase_stock to test_limits 94m Succeed Log
Build 418238 Post install tests: from test_mail to to_purchase_line_numbering 144m Succeed Log
Build 418239 Post install tests: from to_purchase_order_advance to viin_approval_purpose_routing 99m Succeed Log
Build 418240 Post install tests: from viin_approval_sale to viin_product_approval_marketplace 119m Succeed Log
Build 418241 Post install tests: from viin_product_approval_marketplace_website_sale to web_unsplash 84m Succeed Log
Build 418242 Post install tests: from website to website_sms 94m Succeed Log
Create Date Level Message
09/24/2026 13:20:35 INFO
Updated repository Viindoo-tvtmaaddons
09/24/2026 13:20:35 INFO
Updated repository Viindoo-erponline-enterprise
09/24/2026 13:20:35 INFO
Updated repository Viindoo-branding
09/24/2026 13:20:35 INFO
Cloned repository Viindoo-odoo