Skip to content

Bug 635072: Subcontracting order uses Prod. Order Line location, not Work Center#9080

Open
alexei-dobriansky wants to merge 1 commit into
mainfrom
bugs/635072-EASY-SubcontractingLocationCode
Open

Bug 635072: Subcontracting order uses Prod. Order Line location, not Work Center#9080
alexei-dobriansky wants to merge 1 commit into
mainfrom
bugs/635072-EASY-SubcontractingLocationCode

Conversation

@alexei-dobriansky

@alexei-dobriansky alexei-dobriansky commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fixes AB#635072

InsertReqWkshLine overrode the requisition line Location/Bin with the Work Center location when set, so Create Subcontracting Order produced a different location than the Worksheet/CalculateSubcontracts path (which always uses the Prod. Order Line location). Standardize on the Prod. Order Line location to match the two existing correct implementations. Adds a test in CU 139981.

…Work Center

InsertReqWkshLine overrode the requisition line Location/Bin with the Work
Center's Location when it was set, so 'Create Subcontracting Order' produced a
different location than the Worksheet/CalculateSubcontracts path (which always
uses the Prod. Order Line location). Standardize on the Prod. Order Line location
to match the two existing correct implementations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jul 3, 2026
@alexei-dobriansky alexei-dobriansky added the SCM GitHub request for SCM area label Jul 3, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 3, 2026
@alexei-dobriansky alexei-dobriansky self-assigned this Jul 3, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor Author

Agentic PR Review - Round 1

Recommendation: Accept with Suggestions

What this PR does

This PR removes the Work Center location override in Subc. Purchase Order Creator when it builds the requisition line for Create Subcontracting Order. The purchase line now uses ProdOrderLine."Location Code" and ProdOrderLine."Bin Code", matching SubcCalculateSubcontracts, BaseApp CalculateSubcontracts, and the subcontracting transfer-location code that starts from the production order line.

The root cause is addressed for the reported inconsistency: the routing-line action no longer produces a different purchase location than the worksheet path when the Work Center has its own location. The remaining behavior change is intentional but important: any customer who relied on the Work Center location on this action will now get the Prod. Order Line location instead.

Suggestions

S1 - Use explicit production order location in test
The new test creates the production order with LocationCode = ''. Set a separate non-empty Prod. Order Line location and assert that exact value, so the test matches AB#635072 and proves the value is copied, not just cleared.

S2 - Remove unused Work Center load fields
After this change, WorkCenter."Location Code" and "Open Shop Floor Bin Code" are not read in InsertReqWkshLine. Remove them from SetLoadFields to make the chosen rule clear and avoid loading unused data.

Risk assessment and necessity

Risk: The regression surface is limited to subcontracting purchase orders created from released production order routing lines. It changes document location/bin behavior for setups with a Work Center location, and CI was still in progress when reviewed, but the code path is covered by a new targeted test.

Necessity: The bug is valid because the same subcontracting setup could create purchase orders with different locations depending on the user action. Standardizing on Prod. Order Line location is consistent with the worksheet path, BaseApp, and transfer-order logic.


[AI-PR-REVIEW] version=1 system=github pr=9080 round=1 by=alexei-dobriansky at=2026-07-06T09:02:19.0210909Z lastSha=c300fdc615e086887a14db296e04d008f6f77bc7 suggestions=S1,S2

@alexei-dobriansky alexei-dobriansky marked this pull request as ready for review July 6, 2026 14:10
@alexei-dobriansky alexei-dobriansky requested review from a team July 6, 2026 14:10
@alexei-dobriansky alexei-dobriansky added the Subcontracting Subcontracting related activities label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Performance} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

InsertReqWkshLine still calls WorkCenter.SetLoadFields with "Location Code" and "Open Shop Floor Bin Code", but the diff removes the only code in this procedure that read those two fields (the Work-Center-location branch was deleted; the procedure now always uses ProdOrderLine's location/bin).

Per the referenced guidance, SetLoadFields should list exactly the fields the following read uses — these two are now dead weight on every WorkCenter.Get call in this procedure.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

        WorkCenter.SetLoadFields("Subcontractor No.", "Unit Cost Calculation");

Knowledge:

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

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Findings by domain

Findings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).

Domain Findings Knowledge-backed Agent Inline Fallback
Performance 1 1 0 0 1

Totals: 1 knowledge-backed · 0 agent findings.

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

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 SCM GitHub request for SCM area Subcontracting Subcontracting related activities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant