[Subcontracting] Bug 638464: Remove Subc. Detailed Calculation report; extend BaseApp report via event#8673
[Subcontracting] Bug 638464: Remove Subc. Detailed Calculation report; extend BaseApp report via event#8673ChethanT wants to merge 10 commits into
Conversation
…report via event - Remove Report 99001500 (Subc. Detailed Calculation) which was a full copy of BaseApp Report 99000756 - Rewrite SubcReportingTriggersExt to subscribe to new BaseApp event OnAfterGetRecordRoutingLineOnBeforeCalcRoutingCostPerUnit - Event subscriber applies subcontractor pricing when Work Center has a subcontractor - Remove report from permission set - Add test verifying BaseApp report uses subcontractor pricing via event This eliminates duplicate Tell Me entries, preserves extensibility, and fixes the no-op report substitution (which checked ReportId = 99001500 and set NewReportId = 99001500). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Deleted report still referenced; build failsThe Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
Permission for deleted report removed but D365 READ not updatedThe Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
Dead reference to deleted report causes compile errorThe Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
Test runs deleted report via still-active substitutionThe test declares Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
Reference to deleted report causes compile errorThe Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
Redirect subscriber conflicts with new event approachWith the base report's Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
Copilot PR ReviewIteration 3 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630 Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 0 knowledge-backed · 1 agent findings. Orchestrator pre-filter (13 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
| LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::"Subc. Pricing Test"); | ||
| end; | ||
|
|
||
| [Test] |
There was a problem hiding this comment.
The new test procedure DetailedCalculationReportUsesSubcontractorPricing calls Commit() explicitly (line 730) but carries no [TransactionModel(TransactionModel::AutoCommit)] attribute.
Per the referenced guidance, when the test code itself issues Commit(), the test method must declare TransactionModel = AutoCommit; applying the default AutoRollback to a test that calls Commit() produces a runtime error on the first Commit, leaving no business-logic verdict. Add [TransactionModel(TransactionModel::AutoCommit)] immediately before [Test] on this procedure. Because this commits data to the database, pair the test codeunit with a TestIsolation-enabled test runner so committed changes are reverted at the suite level.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
[TransactionModel(TransactionModel::AutoCommit)]
[Test]Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| WorkCenter: Record "Work Center"; | ||
| SubcPriceManagement: Codeunit "Subc. Price Management"; | ||
| begin | ||
| #if not CLEAN29 |
There was a problem hiding this comment.
The event subscriber OnAfterGetRecordRoutingLineOnBeforeCalcCost sets IsHandled := true at the end but never checks if IsHandled then exit; at the start.
In the BC IsHandled pattern, a subscriber that does not guard on entry will overwrite the work of any earlier subscriber that already set IsHandled := true — for example, a partner extension or future Microsoft extension that also customises routing-cost calculation for subcontractor work centres. Add if IsHandled then exit; as the very first statement in the procedure body to respect the contract.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
if IsHandled then
exit;
if RoutingLine.Type <> RoutingLine.Type::"Work Center" then
exit;👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
Summary
Root Cause
\SubcReportingTriggersExt\ subscribed to \SubstituteReport\ but checked \if ReportId = Report::"Subc. Detailed Calculation"\ and set \NewReportId\ to itself (99001500 → 99001500). This was a no-op — it should have been substituting the BaseApp report (99000756).
Fix
Test
Added \DetailedCalculationReportUsesSubcontractorPricing\ in codeunit 139982 "Subc. Pricing Test" — [SCENARIO 638464].
Fixes AB#638464
🤖 Generated with GitHub Copilot