-
- Downloads
[FIX] stock_account: convert qty to product UOM before creating an SVL
Steps to reproduce the bug: - Create a Storable product “P1”: - UOM: unit - Update the qty to 100 - Create an out transfert: - Product: P1 - Qty: 2 - UOM: dozens - Validate the transfert - Click on the valuation button - an SVL is created with Qty: 24 → 2 pack of 12 - Go back to the picking: - Unlock it - change the done qty from 2 to 3 - Lock the picking Problem: The quantity on the new SVL is not converted to the default UoM set on the product. In the write function of `stock.move.line` we calculate the difference between the old and the new qty (3 - 2), then, the `_create_correction_svl` is called: https://github.com/odoo/odoo/blob/15.0/addons/stock_account/models/stock_move_line.py#L45-L48 without converting the diff qty into the product uom, The `_create_out_svl` function is called with the `forced_quantity` parameter: https://github.com/odoo/odoo/blob/15.0/addons/stock_account/models/stock_move_line.py#L66 As it is a forced quantity, it will not convert it: https://github.com/odoo/odoo/blob/14.0/addons/stock_account/models/stock_move.py#L188 Solution: Convert diff qty in the `_create_correction_svl`, to avoid converting it in every function it may call opw-3041279 closes odoo/odoo#104317 X-original-commit: 30aaa668 Signed-off-by:Arnold Moyaux (arm) <arm@odoo.com> Signed-off-by:
Djamel Touati (otd) <otd@odoo.com>
Loading
Please register or sign in to comment