Skip to content
Snippets Groups Projects
Commit 4dbd7354 authored by Adrien Widart's avatar Adrien Widart
Browse files

[FIX] stock: set default value for inventory_quantity_set

When a quant is creating, for instance thanks to an internal transfer,
some of these computed fields will have an incorrect value

To reproduce the issue:
1. In Settings, enable "Storage Locations"
2. Create a storable product P
3. Update P's quantity: 100 P in WH/Stock
4. Process an internal transfer
    - From: WH/Stock
    - To: WH/Stock/Shelf 1
    - Operations: 10 x P
5. Consult the on hand quantities of P

Error: There is a new line with 10 x P in WH/Stock/Shelf 1, which is
correct. However, the Counted Quantity field is defined and equal to 0,
and so does the Difference field with a value of -10. These two fields
should not be shown.

When validating the internal transfer, a new quant is created for the
location "Shelf 1". However, there isn't any value for the field
`inventory_quantity_set`. Therefore, at the end of the transfer
validation process, when the `flush` method is called, since
`inventory_quantity_set` is a computed field, its  `compute` method is
called and define the value to `True`:
https://github.com/odoo/odoo/blob/8b155b695823dfa954464ad0d5dd07445ece2471/addons/stock/models/stock_quant.py#L134-L136


This explains why, on front-end, the Counted Quantity and Difference
fields are displayed.

OPW-2733937

closes odoo/odoo#83942

Signed-off-by: default avatarArnold Moyaux <arm@odoo.com>
parent efcb432f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment