You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shipped quantity is wrong when stock is removed after it was allocated to a sales order #13285
Please verify that this bug has NOT been raised before.
I checked and didn't find a similar issue
Describe the bug*
I allocated a stock item to a sales order, and later removed some of that stock (it was damaged). The allocation stayed at the old amount.
When I completed the shipment, the order line says 10 shipped, but the stock item that went to the customer only has 2 in it. So the order thinks more went out than actually did. I'm not sure if removing allocated stock is supposed to be allowed, but the shipped number definitely looks wrong. Screenshots below.
Steps to Reproduce
Add a stock item of 10 for a salable part (on the demo I used Blue Widget, batch D04, in Offsite Storage)
Make a sales order with one line for 10 of that part and issue it
Allocate all 10 from that stock item to the line (to the order's shipment)
Open the stock item and use Remove Stock to remove 8. It now shows Quantity 2, but Allocated to Orders still says 10
Complete the shipment
Look at the order line: it says Shipped 10 / 10. Open the stock item that was sent to the customer: it has quantity 2
Expected behaviour
I'd expect either a warning or block when removing stock that is allocated, or the allocation to go down to what is left. Either way the line should only count what actually shipped (2), not 10.
Deployment Method
None
Version Information
1.8.0 dev
Try to reproduce on the demo site
I tried to reproduce
Is the bug reproducible on the demo site?
Reproducible
Relevant log output
On the demo it's SO0029 and the Blue Widget stock item with batch D04, until the daily reset.
I have reviewed this report for correctness and filled out all sections.
I have checked this report. I acknowledge that filing bugs via AI agents without review might lead to being blocked.
I think the issue here is deeper than the title suggests. Really the problem is that removing quantity from a stock item that is already allocated, such that the remaining quantity is less than the total allocations, is quietly accepted.
This becomes even more complex when there are multiple allocations against the item.
This is not just limited to sales orders - other orders that accept allocations (build order, transfer orders, etc) would be impacted here too. Any solution will need to consider all applications.
Problem 1 - Block Stock Decrease
block the decrease with a clear warning to the user - the correct action is to manually adjust the outstanding stock allocations and then retry the decrease action again
Problem 2 - Fix allocation bug
When completing an allocation - the quantity actually allocated should be the minimum of (amount_allocated, quantity_available) - so if the available quantity has decreased below the allocated amount, we do not allocate phantom stock that does not exist any more
Problem 3 - Partial Transfers
A partial stock transfer can lead to the same issue as Problem 1 - reducing available stock below total allocation. This should throw an error to the user also
Activity
SchrodingersGat commentedon Nov 14, 2026
I think the issue here is deeper than the title suggests. Really the problem is that removing quantity from a stock item that is already allocated, such that the remaining quantity is less than the total allocations, is quietly accepted.
This becomes even more complex when there are multiple allocations against the item.
This is not just limited to sales orders - other orders that accept allocations (build order, transfer orders, etc) would be impacted here too. Any solution will need to consider all applications.
Problem 1 - Block Stock Decrease
block the decrease with a clear warning to the user - the correct action is to manually adjust the outstanding stock allocations and then retry the decrease action again
Problem 2 - Fix allocation bug
When completing an allocation - the quantity actually allocated should be the minimum of (
amount_allocated,quantity_available) - so if the available quantity has decreased below the allocated amount, we do not allocate phantom stock that does not exist any moreProblem 3 - Partial Transfers
A partial stock transfer can lead to the same issue as Problem 1 - reducing available stock below total allocation. This should throw an error to the user also
Fixes