Repository navigation
Record the quantity actually moved when a transfer exceeds stock - #13295
Merged
SchrodingersGat merged 1 commit intoNov 16, 2026
Merged
Conversation
Requesting a transfer quantity larger than the stock item quantity moves the entire item, but the tracking entry recorded the requested quantity. Clamp the quantity to the item quantity before recording the event. Fixes inventree#13259 Co-Authored-By: Claude Opus 5.5 <[email protected]>
👷 Deploy request for inventree-web-pui-preview pending review.Visit the deploys page to approve it
|
SchrodingersGat
approved these changes
Nov 16, 2026
Member
|
@Quimxi thanks for the fix :) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #13295 +/- ##
==========================================
- Coverage 90.34% 90.32% -0.02%
==========================================
Files 901 901
Lines 83191 83343 +152
Branches 4272 4272
==========================================
+ Hits 75158 75282 +124
- Misses 7017 7045 +28
Partials 1016 1016
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
SchrodingersGat
pushed a commit
that referenced
this pull request
Nov 16, 2026
) (#13300) Requesting a transfer quantity larger than the stock item quantity moves the entire item, but the tracking entry recorded the requested quantity. Clamp the quantity to the item quantity before recording the event. Fixes #13259 (cherry picked from commit dfc5ca9) Co-authored-by: Quimxi <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13259
When a transfer requests more than the stock item quantity,
StockItem.move()moves the whole item (as before), but the tracking entry stored the requested quantity. This clamps the quantity to the item quantity before the tracking entry and theITEM_MOVEDevent are recorded.StocktakeTest.test_transfer_more_than_available, covering a move to another location and to the same location. It fails on master (records 25 instead of 10) and passes with the change.Not included, happy to follow up if wanted:
StockAdjustmentItemSerializerinstead. I left that out because it would change the API behaviour for clients that rely on "more than available moves everything".Tested locally with the
stocktest suite on SQLite. One unrelated failure (stock.tests.TestResultTest.test_duplicate_item_tests) also fails on master in my environment because plugins were disabled.