Skip to content
Snippets Groups Projects
  • yhu-odoo's avatar
    3b88958f
    [FIX] stock_account: valuation layer is zero when return dropshipping · 3b88958f
    yhu-odoo authored
    
    To reproduce:
    1. Create a Sales Order for a product whose product category is set to
       FIFO and automated. Use route "dropship".
    2. Confirm the PO created.
    3. Deliver the products (DS transfer)
    4. Create the customer invoice
    5. Return, for example, 1 unit of product
    6. Add a credit note to the invoice for that 1 unit returned (reset to
       draft then change qty and post)
    Issues:
    The value on the valuation layers of the returned picking is 0, posted
    entries for COGS and stock interim (delivered) account for credit note
    is also 0.
    
    Since #85751, When create valuation layer for return, we take all svls
    of origin_returned_move_id into account to calculate the price unit.
    However, then dropshiping, 2 svls are created for the original move, and
    the sum of them is 0 since there is no impact of the stock when
    dropshiping. So when return, the price unit will be calculated as 0.
    
    To fix, when calculate price unit for return of dropshiping, we only
    take non-negative svls into account. Note that we use non-negative ones
    instead of positive ones because when subcontract dropshiping,
    additional negative svls will be added for the cost of the components.
    
    opw-3283436
    
    closes odoo/odoo#123529
    
    Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
    3b88958f
    History
    [FIX] stock_account: valuation layer is zero when return dropshipping
    yhu-odoo authored
    
    To reproduce:
    1. Create a Sales Order for a product whose product category is set to
       FIFO and automated. Use route "dropship".
    2. Confirm the PO created.
    3. Deliver the products (DS transfer)
    4. Create the customer invoice
    5. Return, for example, 1 unit of product
    6. Add a credit note to the invoice for that 1 unit returned (reset to
       draft then change qty and post)
    Issues:
    The value on the valuation layers of the returned picking is 0, posted
    entries for COGS and stock interim (delivered) account for credit note
    is also 0.
    
    Since #85751, When create valuation layer for return, we take all svls
    of origin_returned_move_id into account to calculate the price unit.
    However, then dropshiping, 2 svls are created for the original move, and
    the sum of them is 0 since there is no impact of the stock when
    dropshiping. So when return, the price unit will be calculated as 0.
    
    To fix, when calculate price unit for return of dropshiping, we only
    take non-negative svls into account. Note that we use non-negative ones
    instead of positive ones because when subcontract dropshiping,
    additional negative svls will be added for the cost of the components.
    
    opw-3283436
    
    closes odoo/odoo#123529
    
    Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>