Skip to content

OBPIH-7575 Remove lines added manually when submitting a request#5619

Merged
kchelstowski merged 1 commit intorelease/0.9.6from
bug/OBPIH-7575
Nov 13, 2025
Merged

OBPIH-7575 Remove lines added manually when submitting a request#5619
kchelstowski merged 1 commit intorelease/0.9.6from
bug/OBPIH-7575

Conversation

@kchelstowski
Copy link
Collaborator

✨ Description of Change

Link to GitHub issue or Jira ticket:

Description:


📷 Screenshots & Recordings (optional)

@kchelstowski kchelstowski self-assigned this Nov 13, 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 Nov 13, 2025
@alannadolny alannadolny requested a review from Copilot November 13, 2025 14:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements functionality to prevent empty requisition items (with zero or null quantity) from being added when manually creating new lines during request submission.

Key Changes:

  • Added a conditional check to skip saving new requisition items when removeEmptyItems flag is true and the item has zero quantity

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

requisitionItem.comment = stockMovementItem.comments
requisitionItem.quantityCounted = stockMovementItem.quantityCounted
// If it's a new item and remove empty items flag is true, we do not want to save it if its quantity is 0
if (removeEmptyItems && !requisitionItem.quantityApproved) {
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

The condition checks !requisitionItem.quantityApproved after it has just been set to stockMovementItem.quantityRequested on line 2528. This means the check will always use the value from quantityRequested, not the original quantityApproved.

For consistency with the existing item check on line 2493 (which checks !stockMovementItem.quantityRequested), this should directly check:

if (removeEmptyItems && !stockMovementItem.quantityRequested) {
    return
}

This would correctly skip adding new items when their quantity requested is 0 or null.

Suggested change
if (removeEmptyItems && !requisitionItem.quantityApproved) {
if (removeEmptyItems && !stockMovementItem.quantityRequested) {

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copilot, I did it intentionally, as stockMovementItem.quantityRequested is BigDecimal.
Normally if you do:

BigDecimal test = "0"

it gets parsed to "48", so !test would return false.

Somehow, the BigDecimal that comes from stockMovementItem is treated properly as "0":
Screenshot From 2025-11-13 15-57-08

but I would prefer not to rely on the magic that bindData did to make this BigDecimal be treated as "0", to prevent any further refactors before we stop sending numbers per string.

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/0.9.6@bbe69d3). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ih/warehouse/inventory/StockMovementService.groovy 0.00% 3 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##             release/0.9.6   #5619   +/-   ##
===============================================
  Coverage                 ?   8.52%           
  Complexity               ?    1127           
===============================================
  Files                    ?     712           
  Lines                    ?   45623           
  Branches                 ?   10916           
===============================================
  Hits                     ?    3890           
  Misses                   ?   41154           
  Partials                 ?     579           

☔ 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.

@kchelstowski kchelstowski merged commit a0172fc into release/0.9.6 Nov 13, 2025
13 checks passed
@kchelstowski kchelstowski deleted the bug/OBPIH-7575 branch November 13, 2025 15:13
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.

5 participants