-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(stock): don't reserve qty on sales return. #31017
Conversation
Hoping I don't have to re-write that query using the new query builder 😅 |
Codecov Report
@@ Coverage Diff @@
## develop #31017 +/- ##
===========================================
- Coverage 63.07% 62.79% -0.28%
===========================================
Files 985 985
Lines 67272 67283 +11
===========================================
- Hits 42431 42251 -180
- Misses 24841 25032 +191
|
This might need a patch, maybe calling get_reserved_qty and updating each row in tabBin ? |
Not required for fixes. Required for new queries. |
@dj12djdjs can you add a short test to avoid regression? Useful utils:
|
@ankush I cannot get the test to pass. It works when I do it over the browser, but in the test environment the status of the documents is not even changing. I'm not sure how to proceed. |
I need to look into why the test is still failing. I was thinking make_item is generating a unique item based on a hash so there shouldn't be any other stock based on that item. I guess I was wrong. |
@dj12djdjs will look into it today 👍 |
@ankush Looks good now |
@dj12djdjs this is kind of a breaking behaviour. E.g. There are users for whom returned qty means they might have to send more to fulfill the order and hence reservation makes sense for them. Others can close the sales order to remove reservations if further deliveries are not to be made. |
Good point, maybe we can add something in the stock settings. Something like,
LOL, I guess I'm gonna have to convert that query using the Query Builder if that's the case. Should be easier to maintain this condition if the query is dynamically built. |
This pull request has been automatically marked as inactive because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
bump |
I have no idea how to open this again 🤣 |
Wait, you're unable to open closed PR? 👀 looks like you pushed a commit after PR got closed c9dce9c still weird, only forced pushed branches don't reopen else it should be fine. |
@ankush That's correct. I was thinking if I pushed something to the branch it might re-open. Sadly, it didn't. |
Before PR
When a sales return is issued, the qty returned will be marked as "Reserved Qty".

After PR
When a sales return is issued, the qty returned won't reflect reserved qty.

References
https://discuss.erpnext.com/t/reserved-item-on-submit-of-sales-order-not-coming-back-to-stock-on-sales-return/51436
https://discuss.erpnext.com/t/after-return-the-product-appears-with-reserved-quantity-in-the-stock-summary/34829