Skip to content
Snippets Groups Projects
  • Nicolas Martinelli's avatar
    e5321896
    [FIX] stock: merge quants when unpacking · e5321896
    Nicolas Martinelli authored
    
    1. Create a new location of type internal in WH/Test
    2. Create a new product P with availability of 100.0 in WH/Stock
    3. Create a new transfer from WH/Stock to WH/Test with 50.0 units of P,
       Put in Pack and Validate
    4. Create a new transfer from WH/Test to WH/Stock/Shelf 1 using the
       previous package, Validate and Unpack
    5. Repeat steps from 3 and 4
    6. Create a new transfer from WH/Stock/Shelf 1 to Customer with 100.0 units of P
    7. Review stock quant from the location WH/Stock/Shelf 1
    
    2 quants of the same product in the location WH/Stock/Shelf 1: one
    negative with -50.0 and another positive with 50.0
    
    The step 4 creates 2 quants of 50.0 units, which are reserved at step 6.
    However, when validating the transfer 100.0 units are taken from one of
    the quants.
    
    To prevent this situation, we run the quant vacuum process after
    unpacking. This will merge the 2 quants of 50.0 and prevent any future
    negative quant creation. We also clean zero quants, although this is not
    mandatory to fix our use case.
    
    Closes #53535
    opw-2283707
    
    closes odoo/odoo#54431
    
    X-original-commit: f7168311
    Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
    e5321896
    History
    [FIX] stock: merge quants when unpacking
    Nicolas Martinelli authored
    
    1. Create a new location of type internal in WH/Test
    2. Create a new product P with availability of 100.0 in WH/Stock
    3. Create a new transfer from WH/Stock to WH/Test with 50.0 units of P,
       Put in Pack and Validate
    4. Create a new transfer from WH/Test to WH/Stock/Shelf 1 using the
       previous package, Validate and Unpack
    5. Repeat steps from 3 and 4
    6. Create a new transfer from WH/Stock/Shelf 1 to Customer with 100.0 units of P
    7. Review stock quant from the location WH/Stock/Shelf 1
    
    2 quants of the same product in the location WH/Stock/Shelf 1: one
    negative with -50.0 and another positive with 50.0
    
    The step 4 creates 2 quants of 50.0 units, which are reserved at step 6.
    However, when validating the transfer 100.0 units are taken from one of
    the quants.
    
    To prevent this situation, we run the quant vacuum process after
    unpacking. This will merge the 2 quants of 50.0 and prevent any future
    negative quant creation. We also clean zero quants, although this is not
    mandatory to fix our use case.
    
    Closes #53535
    opw-2283707
    
    closes odoo/odoo#54431
    
    X-original-commit: f7168311
    Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
stock_quant.py 35.72 KiB