Skip to content

[FIX] stock: couldn't unreserve mixed tracking stock#65057

Closed
amoyaux wants to merge 1 commit intoodoo:12.0from
odoo-dev:12.0-fix-mix-reservation-arm
Closed

[FIX] stock: couldn't unreserve mixed tracking stock#65057
amoyaux wants to merge 1 commit intoodoo:12.0from
odoo-dev:12.0-fix-mix-reservation-arm

Conversation

@amoyaux
Copy link
Copy Markdown
Contributor

@amoyaux amoyaux commented Jan 26, 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   |            |       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."

It happens because the system is not able to manage quants with lots and
wihtout lots at the same time. When modifying the move line to 25
reserved units. It's composed of 20 quants with lot and 5 quants without
lot. And when unreserving it will check if there is a quants with 25
units with the lot and if it's not found 25 units without lot. But never
25 units of quants with lots and without lots.

opw-2419444

Close #64497

@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented Jan 26, 2021

Pull request status dashboard

@amoyaux amoyaux force-pushed the 12.0-fix-mix-reservation-arm branch from ea3f848 to baf9154 Compare January 26, 2021 12:11
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

- 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   |            |       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."

It happens because the system is not able to manage quants with lots and
wihtout lots at the same time. When modifying the move line to 25
reserved units. It's composed of 20 quants with lot and 5 quants without
lot. And when unreserving it will check if there is a quants with 25
units with the lot and if it's not found 25 units without lot. But never
25 units of quants with lots and without lots.

opw-2419444

Close odoo#64497
@amoyaux amoyaux force-pushed the 12.0-fix-mix-reservation-arm branch from baf9154 to a05f134 Compare January 26, 2021 12:47
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Jan 26, 2021
@amoyaux
Copy link
Copy Markdown
Contributor Author

amoyaux commented Feb 4, 2021

robodoo r+

robodoo pushed a commit that referenced this pull request Feb 4, 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   |            |       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."

It happens because the system is not able to manage quants with lots and
wihtout lots at the same time. When modifying the move line to 25
reserved units. It's composed of 20 quants with lot and 5 quants without
lot. And when unreserving it will check if there is a quants with 25
units with the lot and if it's not found 25 units without lot. But never
25 units of quants with lots and without lots.

opw-2419444

Close #64497

closes #65057

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
@robodoo robodoo closed this Feb 4, 2021
@robodoo robodoo temporarily deployed to merge February 4, 2021 10:54 Inactive
@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 8, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #65524

4 similar comments
@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 9, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #65524

@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 10, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #65524

@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 11, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #65524

@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 12, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #65524

@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 13, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #66029

2 similar comments
@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 14, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #66029

@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 16, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #66029

@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Feb 24, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #66355

3 similar comments
@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Mar 12, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #66355

@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Apr 13, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #66355

@fw-bot
Copy link
Copy Markdown
Contributor

fw-bot commented Jun 16, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #66355

@diggy128
Copy link
Copy Markdown

diggy128 commented Sep 6, 2021

I believe this should be reverted. It creates more problems than it solves.

I can see the case where a product was once untracked and at some point in time it changed to tracking (either by lots or serial).
But once you've set up tracking you should NOT be able to move products without a lot and that should include reservations. That is the whole point of tracking...

Exactly as the above case, when applying this fix and have such a product (that was once untracked and at some point enabled tracking) creating a move with a lot and negative quantity does NOT create a new quant but adds up to the quant that was created without lot, due to L:206-207 at addons/stock/models/stock_quant.py

The result is only one quant is created for the lot (instead of two) and there is not quantity balance (aka sum = 0) for the quants of the lot.

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.

6 participants