Skip to content
Snippets Groups Projects
user avatar
Touati Djamel (otd) authored
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: default avatarArnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: default avatarDjamel Touati (otd) <otd@odoo.com>
a19f611c
History

Build Status Tech Doc Help Nightly Builds

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