Skip to content

[29.x] Partial Warehouse Shipment with Lot-Tracked Item Fails on Second Shipment Due to Auto-Populated Bin Code and Item Tracking Quantity Validation Error ("You cannot select more than 0 units") - Copy - #10942

Open
sanjmaurya wants to merge 7 commits into
releases/29.xfrom
bugs/Bug-648521-29x-PartialWarehouseShipmentLotTrackedItemFailsSecondShip
Open

Conversation

@sanjmaurya

@sanjmaurya sanjmaurya commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Bug 648521: [ALL-E] [29.x] Partial Warehouse Shipment with Lot-Tracked Item Fails on Second Shipment Due to Auto-Populated Bin Code and Item Tracking Quantity Validation Error ("You cannot select more than 0 units") - Copy

Fixes AB#648521

Issue:
The second partial warehouse shipment of a lot-tracked item fails while assigning item tracking with the error: “You cannot select more than 0 units.”

Cause:
After the first partial shipment, a bin code is populated on the sales line. When item tracking is opened for the subsequent warehouse shipment, InitFromSalesLine() copies this bin code to the tracking specification. Item availability is then incorrectly restricted to that bin, even though the remaining lot-tracked quantity is available in another bin.

Solution:
In CallItemTrackingSecondSource(), clear TrackingSpecification."Bin Code" when the second source is a warehouse shipment line. This prevents item tracking from inheriting the stale sales-line bin and allows the remaining quantity to be selected from the appropriate warehouse bin.

@github-actions github-actions Bot added the Team: SCM GitHub request for SCM area label Sep 2, 2026
@github-actions github-actions Bot modified the milestone: Version 29.1 Sep 2, 2026
@sanjmaurya sanjmaurya changed the title Initial Commit [29.x] Partial Warehouse Shipment with Lot-Tracked Item Fails on Second Shipment Due to Auto-Populated Bin Code and Item Tracking Quantity Validation Error ("You cannot select more than 0 units") - Copy Sep 2, 2026
@sanjmaurya
sanjmaurya marked this pull request as ready for review September 3, 2026 03:02
@sanjmaurya
sanjmaurya requested a review from a team September 3, 2026 03:02
@sanjmaurya
sanjmaurya requested a review from a team as a code owner September 3, 2026 03:02
v-ankitgoyal
v-ankitgoyal previously approved these changes Sep 3, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

What this PR does

This change clears Tracking Specification.Bin Code in the sales and purchase item tracking flows only when the second source is a Warehouse Shipment Line. This matches the reported second partial warehouse shipment scenario, where the source line can keep a shipment bin after the first posting.

Warehouse Shipment Line.OpenItemTrackingLines passes Warehouse Shipment Line in SecondSourceQuantityArray[1], so the new checks run only for warehouse shipment second-source calls. The clear happens before SetSourceSpec, where item tracking copies the bin to its availability filter, and the added tests verify that both sales and purchase source specs reach the tracking page with a blank bin.

Problem-solution fit

Fit: Strong

The change targets the stale bin code that restricts lot availability to the wrong bin during the second partial shipment. It does not broaden normal item tracking calls because non-warehouse-shipment second sources keep their source-line bin.

Suggestions

None.

Risk assessment and necessity

Risk: The regression surface is sales and purchase warehouse shipment item tracking. Other item tracking entry points keep the existing bin behavior, and no public signature or event signature changes.

Necessity: The change is needed because the stale shipment bin can block selecting the remaining tracked quantity. The scope is small and is covered by direct regression tests for the changed sales and purchase paths.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10942 round=1 by=alexei-dobriansky at=2026-09-03T06:05:26.379Z lastSha=b6fe0c65b6a0a0dcb5345e9f6601e9a8776e968a reviewKey=4b16762ee7f81e800c4c86670bcb9529131f529230dfc3e41addfefb890f4cee suggestions=

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Accept

What this PR does

Since round 1, the change was narrowed to the sales warehouse-shipment item-tracking path, and the purchase-side edit was removed. The current net diff clears the sales tracking specification bin only when item tracking is opened from a warehouse shipment line. That matches the reported failure: the stale sales-line shipment bin should not limit Select Entries when the remaining lot is still available in the pick bin. The added regression test covers a directed pick location, FEFO, two lots, a first partial shipment, item tracking on the second shipment, and the second pick lines.

Problem-solution fit

Fit: Strong

The reported problem is clear and the fix targets the root cause without changing the normal sales-line item tracking entry point. The test follows the important inventory path through shipment posting and the second pick, so the code and coverage fit the scenario well.

New observations (commits since round 1)

None - I found no new blocking or non-blocking suggestions in the current diff.

Risk assessment and necessity

Risk: This is an inventory and warehouse posting-adjacent path, so a wrong bin or quantity decision could create incorrect pick or tracking data. The product change is narrow: it only affects sales-line item tracking opened with a warehouse shipment line as the second source, and the second-source quantity is still passed to the item tracking page.

Necessity: The change is needed because the stale sales-line bin can block selection of the remaining lot during the second partial warehouse shipment. The scope is appropriate for the bug, and the new test exercises the money/inventory-sensitive path that would regress.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10942 round=2 by=alexei-dobriansky at=2026-09-03T12:16:32Z lastSha=c5610b3c9a5265b7eb60e7143f41d65176fb73fc reviewKey=3be90095727ff8494cfe524dc96b4e207f645a8b431dc6b0adfc6f6b30eb90f8 suggestions=none parentRound=1

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 3

Recommendation: Request Changes

What this PR does

This PR clears the copied sales-line bin code before item tracking opens from a warehouse shipment line. That keeps Select Entries from being limited to the bin used by the first partial shipment.

The production change is targeted, but the regression test still misses one modal page in the Select Entries flow. Because the test cannot handle the summary page that opens next, it does not reliably prove the fix.

Status of previous suggestions

None - the previous round did not carry open suggestions.

New observations (commits since round 2)

S1 (🔴 High): Add the missing summary page handler
The handler list handles the warehouse item tracking page and the item tracking page, but not Item Tracking Summary. The Select Entries action opens that modal page, so this test needs an Item Tracking Summary handler before it can run and prove the inventory fix.

Risk assessment and necessity

Risk: The production change is narrow to sales item tracking opened from warehouse shipment lines, but it affects warehouse shipment item tracking. The intended regression coverage is important because this flow moves tracked inventory through partial shipment and pick creation.

Necessity: The production change is needed because a stale bin code can block selection of the remaining tracked inventory for a second partial shipment. The test also needs to run through the full Select Entries modal chain so the fix is protected.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10942 round=3 by=alexei-dobriansky at=2026-09-07T06:14:17Z lastSha=031786f11645f19a0f1621c6a46af460ee8814fc reviewKey=a58ce0f45199cf5da74cd3cc78fb88f3193b9f6e86740540a75236f6015dd392 suggestions=S1@06fd00c0:new parentRound=2

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 4

Recommendation: Accept

What this PR does

Since round 3, the test adds the missing Item Tracking Summary modal handler and includes it in the handler list for the Select Entries flow. The production change is unchanged: it clears the copied sales-line bin code only when item tracking is opened from a warehouse shipment line.

The new handler matches the modal page opened by Select Entries, so the regression test can now continue through the summary page and verify that the remaining lot reaches the second pick.

Status of previous suggestions
ID Title Status Author response
S1 Add the missing summary page handler Addressed Fixed in c55dd45
New observations (commits since round 3)

None - the new commit only addresses the previous test-handler gap.

Risk assessment and necessity

Risk: The incremental change is test-only and adds the modal handler that the existing Select Entries flow requires. The production risk remains limited to sales warehouse-shipment item tracking, where the change avoids using a stale source-line bin as an availability filter.

Necessity: The production change is needed because a stale bin can block selection of the remaining tracked inventory for a second partial shipment. The test-handler change is needed so the regression test can run through the full modal chain that exercises the fix.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10942 round=4 by=alexei-dobriansky at=2026-09-07T12:14:43Z lastSha=c55dd45b04058f2aaa1082c89e100729ceee6072 reviewKey=b2739850e97f9ac8a699b5b55a442116c2a37a207c3e49a3be501ff557178e9c suggestions=S1@06fd00c0:addressed parentRound=3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The stale sales-line bin is cleared only for warehouse-shipment second-source item tracking, preserving existing behavior for other entry points. The regression test exercises the complete partial-shipment flow and verifies that the remaining lot and quantity reach both lines of the second pick. The previously missing Item Tracking Summary modal handler is now included.

v-ankitgoyal
v-ankitgoyal previously approved these changes Sep 8, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 5

Recommendation: Accept

What this PR does

Since round 4, the regression test now creates lot expiration dates relative to WorkDate instead of using fixed dates. The production change is unchanged: item tracking opened from a sales warehouse shipment line clears the copied sales-line bin before Select Entries calculates availability.

The new test-only change keeps FEFO ordering stable and avoids a date-sensitive test failure. The full fix still matches the reported problem because the stale shipment bin no longer limits availability for the second partial shipment.

Status of previous suggestions
ID Title Status Author response
S1 Add the missing summary page handler Addressed Already addressed in round 4; no new change needed.
New observations (commits since round 4)

None - the new commit only makes the regression test dates relative to WorkDate.

Risk assessment and necessity

Risk: The round-5 change is test-only. The production risk remains limited to sales warehouse-shipment item tracking, with no public API or event signature change.

Necessity: The production fix is needed because a stale shipment bin can block selection of the remaining tracked lot for a second partial shipment. The date change is needed to keep the regression test stable across build contexts.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10942 round=5 by=alexei-dobriansky at=2026-09-08T06:11:58Z lastSha=35a5f9be2134c1c81daa1c5f564ac0045bf4662b reviewKey=e7634993fd10d6e08c1fce5ae55ae7a64c3ebac923f2bd62947138dda3d02f1e suggestions=S1@06fd00c0:addressed parentRound=4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

S1 - Exercise the failing Select Entries path (High confidence)

The regression test creates a full WMS location and enables Lot Warehouse Tracking. With an open warehouse shipment, ItemTrackingLines.SetWarehouseControls() calls ItemTrkgIsManagedByWhse(), which returns true and sets InsertIsBlocked := true. The Select Entries action therefore exits immediately, before ItemTrackingDataCollection.SelectMultipleTrackingNo() and the failing Item Tracking Summary flow are reached.

The latest commit confirms this gap by removing ItemTrackingSummaryPageHandler because it was not called. The test can still pass because FEFO selects the remaining lot while creating the second pick, independently of the no-op Select Entries invocation. It therefore does not prove that clearing TrackingSpecification."Bin Code" fixes the reported "You cannot select more than 0 units" error.

Please align the fixture with the customer configuration where Select Entries is enabled, require the Item Tracking Summary handler to run, and then verify that the chosen lot flows to the pick. This is required coverage for the behavior change.

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Remember to mirror corrections to the master branch.

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 6

Recommendation: Request Changes

What this PR does

Since round 5, the production fix is unchanged, but the regression test no longer declares the handler for the item tracking summary page. The production change still clears the copied sales-line bin when item tracking is opened from a sales warehouse shipment line, so Select Entries can calculate availability without the stale bin filter.

The code path is narrow: warehouse shipment lines for sales call CallItemTrackingSecondSource, set the warehouse shipment line as the second source, and then open item tracking. Purchase and transfer second-source paths do not use this sales-specific copied-bin flow.

Status of previous suggestions
ID Title Status Author response
S1 Add the missing summary page handler Not addressed No reply; the latest commit removed the handler again.
New observations (commits since round 5)

S1 (🔴 High): Restore the summary page handler
Put ItemTrackingSummaryPageHandler back in the handler list, or stop the test from opening the summary page. The test still invokes Select Entries, and that action runs page Item Tracking Summary when validation is not hidden. Without a handler the test can stop on an unhandled modal page before it verifies the fix.

Risk assessment and necessity

Risk: The production risk remains limited to sales warehouse-shipment item tracking for lot/serial tracked sales lines. The current round risk is in the test: the new regression coverage can fail before it reaches the assertions.

Necessity: The production fix is needed because a stale shipment bin can block selection of the remaining tracked lot for a second partial shipment. The handler is also needed so the regression test can complete the Select Entries workflow.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10942 round=6 by=alexei-dobriansky at=2026-09-08T12:03:37Z lastSha=c6b6a083a041bea362dd9dc9ad2851bf55fac978 reviewKey=7b7710cb2d9ea7d01af4c5ef919c74cba5a8399e8be357b3cba9281b700cf5c8 suggestions=S1@06fd00c0:notaddressed parentRound=5

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 7

Recommendation: Accept

What this PR does

The PR clears the copied sales-line bin code before item tracking opens from a sales warehouse shipment line. Since round 6, the regression test now registers and implements the summary page handler used by Select Entries, so the test can drive the modal page and verify the remaining lot assignment.

The fix is narrow and matches the failing flow. Warehouse Shipment Line passes the warehouse shipment second source into Sales Line-Reserve, and the cleared tracking specification reaches SetSourceSpec before the page calculates availability, so Select Entries is no longer limited by the stale shipment bin from the sales line.

Status of previous suggestions
ID Title Status Author response
S1 Restore the summary page handler Addressed Fixed in the current commit: the handler list includes ItemTrackingSummaryPageHandler, and the handler is present.
New observations (commits since round 6)

None - changes only addressed the previous suggestion.

Risk assessment and necessity

Risk: The regression surface is sales warehouse shipment item tracking with a second source. The code change is limited to that second-source path, does not change public signatures, and the test covers the partial shipment, Select Entries, second pick, and lot assignment flow.

Necessity: The change is needed because the stale bin code blocks selecting remaining lot quantity on the second partial shipment. The scope is right: it removes only the stale availability filter for warehouse shipment item tracking and adds a focused regression test.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10942 round=7 by=alexei-dobriansky at=2026-09-10T06:10:47Z lastSha=7b404c81e7a8022914c21d7737f786608ae4de67 reviewKey=5e1431e97a81d78df5d6ca4c18966ef441122c20ff2fa07404a616281f529077 suggestions=S1@06fd00c0:addressed parentRound=6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team: SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants