Allocated stock should be reverted when cancelling a fullfillment - Part 2
Closed this issue · 0 comments
Describe the bug
Cancelling a fullfillment should restore the allocated stock values of the product. The code here returns the onHand value back, but cancelling a fullfilment is a different process than canceling an order. The allocated value should be returned to the previous value so that a fulfillment can be attempted later.
I've reported a similar issue (#1198) but the fix was only for stockOnHand
not for the stockAllocated
value.
Ideally, cancelling Fulfillment should work like OrderService.createFullfilment (which generates a stock movement) but in reverse :)
To Reproduce
Steps to reproduce the behavior:
- Make an order
- Fullfill that order through the Admin panel
- Cancel that specific fullfilment
Expected behavior
When cancelling a fullfilment, Vendure should return the allocated levels of the products to the pre-fullfilled values. They way it works now, the allocated value is not returned to the pre-fulfillment value.
Environment (please complete the following information):
- @vendure/core version: 1.3.4
- Nodejs version: v14
- Database (mysql/postgres etc): Postgres v11