From a2fbb0736e82764b6d1978aaff8f5a081d0415e1 Mon Sep 17 00:00:00 2001 From: Djordje Cenic Date: Tue, 30 Jun 2026 15:01:50 +0200 Subject: [PATCH 1/6] [G/L VAT Reconciliation] Make report 11 runnable in background and make it commit as it updates VAT Entries AB#640489 --- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../Finance/VAT/Ledger/VATEntry.Table.al | 11 ++++++-- .../VAT/ERMGLVATReconciliation.Codeunit.al | 25 +++++++++++++++++++ .../GLVATReconAdjustSubscriber.Codeunit.al | 14 +++++++++++ 15 files changed, 156 insertions(+), 26 deletions(-) create mode 100644 src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al diff --git a/src/Layers/APAC/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/APAC/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 5f2442a874..49ee5baf52 100644 --- a/src/Layers/APAC/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/APAC/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1363,8 +1363,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1514,6 +1518,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/BE/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/BE/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 260c881193..c35aff10d9 100644 --- a/src/Layers/BE/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/BE/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1170,8 +1170,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1321,6 +1325,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/CH/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/CH/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 6aa2dc10ca..4d24c9a72b 100644 --- a/src/Layers/CH/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/CH/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1193,8 +1193,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1344,6 +1348,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/DACH/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/DACH/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 77ab015431..2fe622dea4 100644 --- a/src/Layers/DACH/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/DACH/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1153,8 +1153,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1304,6 +1308,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/ES/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/ES/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index e400993712..0dc9f24abe 100644 --- a/src/Layers/ES/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/ES/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1274,8 +1274,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1425,6 +1429,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/FI/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/FI/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 079ae9b7e9..8850605176 100644 --- a/src/Layers/FI/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/FI/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1130,8 +1130,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1281,6 +1285,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/FR/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/FR/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 29f8e0f95c..80d76bc4a1 100644 --- a/src/Layers/FR/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/FR/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1148,8 +1148,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1299,6 +1303,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/IT/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/IT/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 28d0305e15..a8ac141409 100644 --- a/src/Layers/IT/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/IT/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1476,8 +1476,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1627,6 +1631,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/NA/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/NA/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index f6770b5f72..2150a1cf2f 100644 --- a/src/Layers/NA/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/NA/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1150,8 +1150,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1301,6 +1305,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/NL/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/NL/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 486b43e9b5..3b7436a36d 100644 --- a/src/Layers/NL/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/NL/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1134,8 +1134,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1285,6 +1289,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/NO/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/NO/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 949682ce94..37475efe86 100644 --- a/src/Layers/NO/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/NO/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1152,8 +1152,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1303,6 +1307,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/RU/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/RU/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 77b338d7ab..74db5b9c85 100644 --- a/src/Layers/RU/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/RU/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1298,8 +1298,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1449,6 +1453,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/W1/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al b/src/Layers/W1/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al index 1fc6d551aa..bbba9e8220 100644 --- a/src/Layers/W1/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al +++ b/src/Layers/W1/BaseApp/Finance/VAT/Ledger/VATEntry.Table.al @@ -1130,8 +1130,12 @@ table 254 "VAT Entry" VATEntryLocal.Copy(Rec); VATEntryLocal.SetRange("G/L Acc. No.", ''); if WithUI then begin - if ShowConfirm then - Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + if GuiAllowed() then begin + if ShowConfirm and not Response then + Response := ConfirmManagement.GetResponseOrDefault(ConfirmAdjustQst, false); + end else + // Background execution has no user to confirm with; proceed so the report can run unattended. + Response := true; if not Response then exit; @@ -1281,6 +1285,9 @@ table 254 "VAT Entry" VATEntryUpdate.SetRange("G/L Acc. No.", ''); VATEntryUpdate.SetFilter("Entry No.", EntryNoFilter.ToText()); VATEntryUpdate.ModifyAll("G/L Acc. No.", GLAccountNo, false); + // Persist each batch so a long-running adjustment that times out can resume from where it + // left off instead of restarting from scratch and never completing. + Commit(); EntryNoFilter.Clear(); TotalChunkDuration += CurrentDateTime() - StartTime; ChunkCount += 1; diff --git a/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al b/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al index 3ab77e6d47..93ae651d0e 100644 --- a/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al +++ b/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al @@ -112,6 +112,31 @@ codeunit 134991 "ERM G/L - VAT Reconciliation" VerifyGLAccountNoInVATEntries(VATEntry, GLAccountNo); end; + [Test] + procedure SetGLAccountNoEventPreApprovalSkipsConfirm() + var + VATEntry: Record 254; + GLVATReconAdjustSubs: Codeunit "GL VAT Recon. Adjust Subs."; + GLAccountNo: array[4] of Code[20]; + begin + // [SCENARIO 640489] When a subscriber to OnBeforeSetGLAccountNo pre-approves the adjustment, the confirm is skipped and processing continues, so the report can run unattended + Initialize(); + + // [GIVEN] 4 G/L Entry - VAT Entry Links, where two of them refer to VAT Entries whose G/L Account Number field is blank + CreateVATEntriesGLEntriesWithLink(GLAccountNo, TransactionNo); + VATEntry.SetRange("Transaction No.", TransactionNo); + + // [GIVEN] A subscriber that pre-approves the adjustment via OnBeforeSetGLAccountNo (Response := true) + BindSubscription(GLVATReconAdjustSubs); + + // [WHEN] The SetGLAccountNo function is called with WithUI set to true (which also requests a confirm) and no ConfirmHandler is registered + VATEntry.SetGLAccountNo(true); + UnbindSubscription(GLVATReconAdjustSubs); + + // [THEN] The G/L Account Number field is correctly set for all the test VAT Entries, without any confirm being raised + VerifyGLAccountNoInVATEntries(VATEntry, GLAccountNo); + end; + local procedure Initialize() begin LibraryTestInitialize.OnTestInitialize(Codeunit::"ERM G/L - VAT Reconciliation"); diff --git a/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al b/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al new file mode 100644 index 0000000000..ee00bd57c8 --- /dev/null +++ b/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al @@ -0,0 +1,14 @@ +using Microsoft.Finance.VAT.Ledger; + +codeunit 135003 "GL VAT Recon. Adjust Subs." +{ + EventSubscriberInstance = Manual; + + [EventSubscriber(ObjectType::Table, Database::"VAT Entry", OnBeforeSetGLAccountNo, '', false, false)] + local procedure PreApproveAdjustmentOnBeforeSetGLAccountNo(var VATEntry: Record "VAT Entry"; var IsHandled: Boolean; var Response: Boolean) + begin + // Pre-approve the adjustment via the event so the confirm dialog is skipped and processing continues. + // IsHandled is intentionally left false so the standard G/L Account No. adjustment logic still runs. + Response := true; + end; +} From d3dc4703f6c30cde7afbc0316c66e39679541087 Mon Sep 17 00:00:00 2001 From: Djordje Cenic Date: Tue, 30 Jun 2026 15:32:10 +0200 Subject: [PATCH 2/6] [G/L VAT Reconciliation] Make report 11 runnable in background and make it commit as it updates VAT Entries --- src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al b/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al index 93ae651d0e..e129ccacc8 100644 --- a/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al +++ b/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al @@ -1,3 +1,5 @@ +using Microsoft.Finance.VAT.Ledger; + codeunit 134991 "ERM G/L - VAT Reconciliation" { Subtype = Test; @@ -115,7 +117,7 @@ codeunit 134991 "ERM G/L - VAT Reconciliation" [Test] procedure SetGLAccountNoEventPreApprovalSkipsConfirm() var - VATEntry: Record 254; + VATEntry: Record "VAT Entry"; GLVATReconAdjustSubs: Codeunit "GL VAT Recon. Adjust Subs."; GLAccountNo: array[4] of Code[20]; begin From f6dbf84aeda74fa1b400062e11d762037c2c7c88 Mon Sep 17 00:00:00 2001 From: Djordje Cenic Date: Tue, 30 Jun 2026 19:33:39 +0200 Subject: [PATCH 3/6] [G/L VAT Reconciliation] Make report 11 runnable in background and make it commit as it updates VAT Entries --- src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al b/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al index ee00bd57c8..4d67a77e51 100644 --- a/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al +++ b/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al @@ -1,6 +1,6 @@ using Microsoft.Finance.VAT.Ledger; -codeunit 135003 "GL VAT Recon. Adjust Subs." +codeunit 134241 "GL VAT Recon. Adjust Subs." { EventSubscriberInstance = Manual; From 3354d0513ed4b72b16feced92aacf15d7155eb57 Mon Sep 17 00:00:00 2001 From: Djordje Cenic Date: Wed, 1 Jul 2026 10:12:09 +0200 Subject: [PATCH 4/6] [G/L VAT Reconciliation] Make report 11 runnable in background and make it commit as it updates VAT Entries --- src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al b/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al index e129ccacc8..2f4a3f2579 100644 --- a/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al +++ b/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al @@ -23,6 +23,7 @@ codeunit 134991 "ERM G/L - VAT Reconciliation" ConfirmAdjustQst: Label 'Do you want to fill the G/L Account No. field in VAT entries that are linked to G/L Entries?'; + [TransactionModel(TransactionModel::AutoCommit)] [Test] procedure VATEntrySetGLAccountNumberWithoutUI() var @@ -67,6 +68,7 @@ codeunit 134991 "ERM G/L - VAT Reconciliation" VerifyGLAccountNoInVATEntries(VATEntry, GLAccountNo); end; + [TransactionModel(TransactionModel::AutoCommit)] [Test] [HandlerFunctions('ConfirmHandlerSetGLAccountNo')] procedure VATEntrySetGLAccountNumberWithUIConfirmYes() @@ -89,6 +91,7 @@ codeunit 134991 "ERM G/L - VAT Reconciliation" VerifyGLAccountNoInVATEntries(VATEntry, GLAccountNo); end; + [TransactionModel(TransactionModel::AutoCommit)] [Test] procedure CallSetGLAccountNumberFromVATEntriesPage() var @@ -114,6 +117,7 @@ codeunit 134991 "ERM G/L - VAT Reconciliation" VerifyGLAccountNoInVATEntries(VATEntry, GLAccountNo); end; + [TransactionModel(TransactionModel::AutoCommit)] [Test] procedure SetGLAccountNoEventPreApprovalSkipsConfirm() var From 26dd145cc9d68596184fa6513e5bec6728d9d4db Mon Sep 17 00:00:00 2001 From: Djordje Cenic Date: Wed, 1 Jul 2026 12:32:00 +0200 Subject: [PATCH 5/6] [G/L VAT Reconciliation] Make report 11 runnable in background and make it commit as it updates VAT Entries --- src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al | 2 -- src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al b/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al index 2f4a3f2579..05cfc23a4c 100644 --- a/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al +++ b/src/Layers/W1/Tests/VAT/ERMGLVATReconciliation.Codeunit.al @@ -1,5 +1,3 @@ -using Microsoft.Finance.VAT.Ledger; - codeunit 134991 "ERM G/L - VAT Reconciliation" { Subtype = Test; diff --git a/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al b/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al index 4d67a77e51..6192f056f0 100644 --- a/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al +++ b/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al @@ -1,5 +1,3 @@ -using Microsoft.Finance.VAT.Ledger; - codeunit 134241 "GL VAT Recon. Adjust Subs." { EventSubscriberInstance = Manual; From 7ce4d5c2649d9e378bb7a2958b261a37ff082a0f Mon Sep 17 00:00:00 2001 From: Djordje Cenic Date: Wed, 1 Jul 2026 15:35:12 +0200 Subject: [PATCH 6/6] Rename subscriber file to match object name (AA0215) --- ...ustSubscriber.Codeunit.al => GLVATReconAdjustSubs.Codeunit.al} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/Layers/W1/Tests/VAT/{GLVATReconAdjustSubscriber.Codeunit.al => GLVATReconAdjustSubs.Codeunit.al} (100%) diff --git a/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al b/src/Layers/W1/Tests/VAT/GLVATReconAdjustSubs.Codeunit.al similarity index 100% rename from src/Layers/W1/Tests/VAT/GLVATReconAdjustSubscriber.Codeunit.al rename to src/Layers/W1/Tests/VAT/GLVATReconAdjustSubs.Codeunit.al