OBPIH-7195 fix4: handle inventory import duplicates and zero out stock for missing rows#5310
OBPIH-7195 fix4: handle inventory import duplicates and zero out stock for missing rows#5310awalkowiak merged 3 commits intodevelopfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5310 +/- ##
============================================
+ Coverage 8.30% 8.36% +0.05%
- Complexity 994 1005 +11
============================================
Files 649 649
Lines 43671 43719 +48
Branches 10585 10602 +17
============================================
+ Hits 3625 3655 +30
- Misses 39486 39498 +12
- Partials 560 566 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| Map<String, AvailableItem> availableItems = productAvailabilityService.getAvailableItemsAtDateAsMap( | ||
| command.location, | ||
| inventoryImportData.products, | ||
| null, |
There was a problem hiding this comment.
Why are you fetching available items for all products in the given location? I think it still should be inventoryImportData.product. I think when you import inventory in the previous version, you modify the stock only for products that are being imported.
There was a problem hiding this comment.
Actually you're right. I misinterpreted Manon's comment. Good catch! I'll revert this
| } | ||
| } | ||
|
|
||
| // Any available items that exist in the system but were not in the import should be set to quantity 0. |
There was a problem hiding this comment.
Imho it should not be any available item, but just these for products imported 🤔
| for (AvailableItem availableItem : availableItems) { | ||
| TransactionEntry transactionEntry = new TransactionEntry( | ||
| quantity: availableItem.quantityOnHand, | ||
| product: availableItem.inventoryItem.product, |
There was a problem hiding this comment.
I have no idea how this was working before. This was always missing from the start... 🤷
There was a problem hiding this comment.
I think it was working because other parts rely on the inventory item, but I am not 100% sure at the moment.
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-7195
Description: Two fixes:
📷 Screenshots & Recordings (optional)
Video explaining the change: https://jam.dev/c/27edbf8b-a984-481e-ba15-a3285114913d