Skip to content

OBPIH-7195 fix4: handle inventory import duplicates and zero out stock for missing rows#5310

Merged
awalkowiak merged 3 commits intodevelopfrom
bug/OBPIH-7195-4
Jun 9, 2025
Merged

OBPIH-7195 fix4: handle inventory import duplicates and zero out stock for missing rows#5310
awalkowiak merged 3 commits intodevelopfrom
bug/OBPIH-7195-4

Conversation

@ewaterman
Copy link
Member

✨ Description of Change

Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-7195

Description: Two fixes:

  1. Allow for duplicate lines in the import. They should each result in separate transaction entries whos quantities sum up to each other.
  2. Any items that have stock but were not included in the import will have their stock set to zero

📷 Screenshots & Recordings (optional)

Video explaining the change: https://jam.dev/c/27edbf8b-a984-481e-ba15-a3285114913d

@ewaterman ewaterman self-assigned this Jun 5, 2025
@github-actions github-actions bot added type: bug Addresses unintended behaviours of the app domain: backend Changes or discussions relating to the backend server labels Jun 5, 2025
@codecov
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.36%. Comparing base (10a1a85) to head (b8b4621).
⚠️ Report is 98 commits behind head on develop.

Files with missing lines Patch % Lines
...rehouse/importer/InventoryImportDataService.groovy 0.00% 22 Missing ⚠️
...rg/pih/warehouse/inventory/InventoryService.groovy 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Map<String, AvailableItem> availableItems = productAvailabilityService.getAvailableItemsAtDateAsMap(
command.location,
inventoryImportData.products,
null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho it should not be any available item, but just these for products imported 🤔

@ewaterman ewaterman requested a review from awalkowiak June 6, 2025 16:46
for (AvailableItem availableItem : availableItems) {
TransactionEntry transactionEntry = new TransactionEntry(
quantity: availableItem.quantityOnHand,
product: availableItem.inventoryItem.product,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how this was working before. This was always missing from the start... 🤷

Copy link
Collaborator

@awalkowiak awalkowiak Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was working because other parts rely on the inventory item, but I am not 100% sure at the moment.

@awalkowiak awalkowiak merged commit 5658c47 into develop Jun 9, 2025
8 checks passed
@awalkowiak awalkowiak deleted the bug/OBPIH-7195-4 branch June 9, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: backend Changes or discussions relating to the backend server type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants