[Main]Incorrect Cost Amount (Actual) in Value Entries after posting Assembly Process and calulating the assembly standard costsInitial commit#9398
Conversation
…Bug-642126--Main]IncorrectCostAmountActualValue-EntriesAfterposting
…tActualValue_EntriesAfterposting
Copilot PR ReviewIteration 2 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@186d8a131465475c79244d994acb872cd5c0d4bf Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 1 knowledge-backed · 0 agent findings. Orchestrator pre-filter (2 file(s) excluded)
Findings produced by the AL review agent v1.7.3. Reply 👎 on any inline comment to flag false positives. |
qasimikram
left a comment
There was a problem hiding this comment.
S1 - Regression test does not verify the reported cost invariant (High confidence)
In SCMCalculateAssemblyCost.Codeunit.al, CalcAssemblyStdCostDoesNotDistortAssemblyOutputActualCost only asserts that no Manufacturing Overhead variance entry exists. Bug 642126 specifically requires Cost Amount (Actual) / indirect cost to remain 1.12 instead of 1.17. This test could pass if adjustment produces no variance entry but leaves the output at another incorrect amount.
Please assert the resulting assembly-output cost amount, and preferably the relevant indirect-cost value entry, against the rolled standard cost or the explicit expected value. The production logic is directionally consistent with CalcActualUsageCosts, but this high-risk costing change needs an end-state assertion for the customer-visible result.
Bug 642126: [Master] [ALL-E] Incorrect Cost Amount (Actual) in Value Entries after posting Assembly Process and calulating the assembly standard costs
Fixes AB#642126
Issue :- Incorrect Cost Amount (Actual) in Value Entries after posting Assembly Process and calulating the assembly standard costs
Root cause :-
The item's per-unit indirect cost and the per-output indirect cost are computed with inconsistent rounding, so the amounts diverge once Calc. Assembly Std. Cost re-stamps the item's standard cost with high precision.
Solutions :-
The assembly overhead recompute runs after the if/else, covering both branches
if not InvtAdjmtEntryOrder.Find() or not InvtAdjmtEntryOrder."Completely Invoiced" then
InvtAdjmtEntryOrder.GetCostsFromItem(OutputQty)
else begin
InvtAdjmtEntryOrder.RoundCosts(OutputQty);
InvtAdjmtEntryOrder.CalcDirectCostFromCostShares();
InvtAdjmtEntryOrder.CalcIndirectCostFromCostShares();
InvtAdjmtEntryOrder.CalcUnitCost();
end;
if InvtAdjmtEntryOrder."Order Type" = InvtAdjmtEntryOrder."Order Type"::Assembly then begin
InvtAdjmtEntryOrder.CalcOvhdCost(OutputQty); // overhead from stable matcap × Indirect %
InvtAdjmtEntryOrder.RoundCosts(1);
InvtAdjmtEntryOrder.CalcIndirectCostFromCostShares();
InvtAdjmtEntryOrder.CalcUnitCost();
end;