Skip to content

Shipped quantity is wrong when stock is removed after it was allocated to a sales order #13285

Open

Description

@jordan-dimov

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.

1-after-removing-8-qty-2-allocated-10 2-line-shows-shipped-10-of-10 3-item-sent-to-customer-has-qty-2

Steps to Reproduce

  1. Add a stock item of 10 for a salable part (on the demo I used Blue Widget, batch D04, in Offsite Storage)
  2. Make a sales order with one line for 10 of that part and issue it
  3. Allocate all 10 from that stock item to the line (to the order's shipment)
  4. Open the stock item and use Remove Stock to remove 8. It now shows Quantity 2, but Allocated to Orders still says 10
  5. Complete the shipment
  6. 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.

Activity

  1. added theissue type on Nov 14, 2026
  2. added
    bug
    question
    triage:not-checked
    on Nov 14, 2026
  3. SchrodingersGat commented on Nov 14, 2026

    @SchrodingersGat
    Member

    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

    Fixes

    Problem PR
    Block Stock Decrease #13298
    Fix allocation bug #13298
    Partial Transfers #13302
  4. added
    stock
    and removed
    question
    triage:not-checked
    on Nov 14, 2026
  5. added this to the 1.8.0 milestone on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstock

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions