Skip to content

[Main][All-E][Subcontracting] Create Return reports nothing to return when an open return order exists - #14605

Open
sanjmaurya wants to merge 1 commit into
mainfrom
bugs/Bug-660833-Main-CreateReturnreportsnothingreturnwhenopenreturnorderexists
Open

sanjmaurya wants to merge 1 commit into
mainfrom
bugs/Bug-660833-Main-CreateReturnreportsnothingreturnwhenopenreturnorderexists

Conversation

@sanjmaurya

@sanjmaurya sanjmaurya commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Bug 660833: [Main][All-E][Subcontracting] Create Return reports nothing to return when an open return order exists

Fixes AB#660833

Issue :- Create Return from Subcontractor displays “Nothing to create” when an open return order exists with one component line deleted, even though that component remains available at the subcontractor.

Cause :- The duplicate-return check operates at the subcontracting purchase-line level. A remaining return line blocks return creation for other components on the same purchase line, triggering the generic “Nothing to create” error.

Solution :- Retain the existing duplicate-return restriction, but detect the open return order and display a clear message identifying the purchase order and instructing the user to complete or delete the existing return order. Added regression coverage for the deleted-component scenario and updated existing tests to expect the new message.

@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Nov 26, 2026
@sanjmaurya
sanjmaurya marked this pull request as ready for review November 26, 2026 11:58
@sanjmaurya
sanjmaurya requested a review from a team as a code owner November 26, 2026 11:58
@github-actions github-actions Bot added the Team: SCM GitHub request for SCM area label Nov 26, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Nov 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

This test contains two separate WHEN actions: creating the return order and attempting the duplicate creation. Its name does not declare a flow or defect-then-fix shape, so split the claims into focused tests or rename and structure the procedure as an explicit flow.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

This test contains two separate WHEN actions: creating the return order and attempting the duplicate creation. Its name does not declare a flow or defect-then-fix shape, so split the claims into focused tests or rename and structure the procedure as an explicit flow.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

The changed partial-shipment tests each contain two WHEN actions: creating the return and then trying to create it again. Because the procedure names do not declare a flow or defect-then-fix relationship, split the claims into focused tests or rename and structure the procedure explicitly as a dependent flow test.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

What this PR does

The change replaces the misleading no-returnable-stock error with guidance when an open subcontracting return transfer order already exists. It keeps the existing duplicate-return restriction rather than enabling additional return cycles.

The new check runs only after both component and WIP eligibility checks find nothing to create. It filters transfer lines to the current purchase order, return orders, and non-derived lines, then checks the linked header's Open status. This catches the remaining return line after another component line is deleted, while preserving the original error when no open return exists. Successful creation, quantities, reservations, and posting logic remain unchanged.

Problem-solution fit

Fit: Strong

The reported scenario explicitly allows retaining the one-return restriction if the error explains the existing open return and how to proceed. The implementation and the new deleted-component regression test directly cover that outcome.

Suggestions

None.

Risk assessment and necessity

Risk: The regression surface is the diagnostic shown after an unsuccessful subcontracting return-creation attempt. The additional read-only lookup is scoped to the purchase order and does not change inventory quantities, posting, public signatures, events, or stored data. Released return orders retain the existing diagnostic because this change specifically checks Open status.

Necessity: Without this change, deleting one component from an otherwise open return leaves available material blocked by the purchase-line duplicate check, but users are incorrectly told that nothing can be returned. Explaining the existing document is a narrowly scoped improvement that avoids changing the supported return process.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=14605 round=1 by=alexei-dobriansky at=2026-11-26T13:19:18.2419626Z lastSha=0f5c50e6c95359d229645f6adb88e614f9086369 reviewKey=7b474d93b5e8a24deb5c4eca64cc53559f5ff2f037081d6eb341cf0afa6b3738 suggestions=none

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.

Thanks for making this message clearer. Two points inline. It would also help to add a test where the existing return is released or shipped before the second attempt, since that is the common real-world case.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

ReturnTransferLine: Record "Transfer Line";
TransferHeader: Record "Transfer Header";
WorkCenter: array[2] of Record "Work Center";
PurchaseOrderPage: TestPage "Purchase Order";

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.

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

This test codeunit mixes a TestPage-driven test with direct business-logic test calls: OpenReturnWithDeletedComponentExplainsExistingReturnOrder drives PurchaseOrderPage, while the adjacent new test calls CreateReturnTransferOrderForPurchaseOrder directly. Separate UI-layer and logic-layer tests into different codeunits so failures identify the layer under test.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

CreateReturnTransferOrderAfterPartialShipOfOutbound contains two distinct WHEN actions: it creates a return transfer order and then attempts to create a duplicate. The procedure name does not declare a flow or defect-then-fix relationship; split the claims into focused tests or explicitly model the procedure as a permitted flow test.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

CreateReturnTransferOrderAfterPartialShipOfOutboundDirectTransfer contains two distinct WHEN actions: it creates a return transfer order and then attempts to create a duplicate. The procedure name does not declare a flow or defect-then-fix relationship; split the claims into focused tests or explicitly model the procedure as a permitted flow test.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7

This branch was successfully deployed

1 active deployment
triage — 0f5c50e6 Deployed Nov 30, 2026 by sanjmaurya via Classify team ownership #12338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Team: SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants