Skip to content

[FIX] stock: fix lot when updating move line & unable to reserve quants#64497

Closed
kitan191 wants to merge 1 commit intoodoo:12.0from
odoo-dev:12.0-opw-2419444-fix_incorrect_lot_and_quant-pta
Closed

[FIX] stock: fix lot when updating move line & unable to reserve quants#64497
kitan191 wants to merge 1 commit intoodoo:12.0from
odoo-dev:12.0-opw-2419444-fix_incorrect_lot_and_quant-pta

Conversation

@kitan191
Copy link
Copy Markdown
Contributor

@kitan191 kitan191 commented Jan 13, 2021

  • Install stock

  • Go to Inventory > Configuration > Settings and enable "Lots" and "Storage Locations"

  • Create a Product tracked By Lots (i.e. Product X)

  • Go to Inventory > Operations > Inventory Adjustments

  • Create an Inventory Adjustment for Product X:

    Product | Location | Lot/SN | Real Quantity
    Product X | WH/Stock | LOT 01 | 20
    Product X | WH/Stock | False | 10

  • Validate Inventory

  • Go to Inventory > Operations > Transfers and create one:

    • Source Location: WH/Stock
    • Destination Location: WH/Stock/Shelf1
    • Operation Type: Internal Transfers
    • Operations:
      [Product: Product X, Initial Demand: 25]
  • Save Transfer, Mark As Todo and Check availability

  • Click on list icon of Operation line for Product X to display Detailed Operations

  • 20 units of LOT 01 and 5 units without lot have been reserved

  • Set LOT 01 for the 5 reserved units without lot and confirm

  • Open Detailed Operations again

  • There are now 20 units of LOT 01 and 5 units of LOT 01

  • Remove the row with 5 units and confirm

  • Check availability and open Detailed Operation

  • There is now only a row with 25 reserved units of LOT 01

  • Unreserve
    The following errror is raised:
    "It is not possible to unreserve more products of P than you have in stock."

This is due to a mismatch between Lot and Quant.
When updating lot_id of the 5 units without lot with LOT 01, it tries to reserve 5 Quants
of LOT 01. As there is no more Quant available for LOT 01, it reserves 5 untracked Quants
instead.
However it still updates lot_id of move line to LOT 01, which is incorrect.
So when the move line with the 5 units is removed, it unreserves 5 units of LOT 01, although
it was untracked units that were reserved.
This is leading to incorrect data in "stock.quant" table:

  • There are 15 reserved units of LOT 01, instead of 20.
  • There are 5 reserved untracked units, instead of 0.

To prevent this to happen, lot_id of move line has to be set to False if untracked quants
have been reserved as a fallback.

opw-2419444

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OE the report is linked to a support ticket (opw-...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants