OBPIH-7444 fail creating adjustment when transaction already exists a…#5440
Merged
kchelstowski merged 1 commit intorelease/0.9.5from Aug 11, 2025
Merged
Conversation
ewaterman
commented
Aug 8, 2025
| inventoryItem { | ||
| inList("product", products) | ||
| } | ||
| } |
Member
Author
There was a problem hiding this comment.
I realized that we should have been checking products, not inventory items. If we only check inventory items, we don't capture the case where we have a transaction at the same time for the same product but with different items.
Seems obvious in hindsight...
kchelstowski
approved these changes
Aug 11, 2025
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.
…t time
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-7444
Description: If we do a cycle count or record stock or inventory import and set quantity to zero for a product, then next CC or RS or II on that product won't have a baseline (because we don't create baselines if quantity == 0, this is something we're going to change in 0.9.6). Because of that, we can successfully create multiple adjustment transactions at the exact same time. To fix this, we need to also check that there are no transactions at the time of the adjustments.
📷 Screenshots & Recordings (optional)
Video showing the bug: https://jam.dev/c/6005951b-9362-454e-8e7b-bc64e31a24a6
Video shows that after this fix, if we do a record stock to set quantity to zero, then an inventory import at the same time should fail, even if it's on different items of the product.
Screencast.from.2025-08-08.11.33.34.AM.webm