Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
"codeunitName": "APIV2 - Sales Credit Memos E2E",
"method": "TestCreateCreditMemoThroughPageAndAPI"
},
{
"codeunitId": 139843,
"codeunitName": "APIV2 - Vendor Payments E2E",
"method": "TestCreateVendorPaymentWithoutDocNo"
},
{
"codeunitId": 139851,
"codeunitName": "APIV2 - Purchase Orders E2E",
Expand All @@ -39,11 +34,6 @@
"codeunitName": "APIV2 - Purch. Cr. Memos E2E",
"method": "TestCreateCreditMemoThroughPageAndAPI"
},
{
"codeunitId": 139867,
"codeunitName": "APIV2 - Apply Vendor Ent. E2E",
"method": "TestApplyVendorEntryAppliesPayment"
},
{
"codeunitId": 139928,
"codeunitName": "APIV2 - Purch. Ret. Shpts. E2E",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ codeunit 130622 "Library - Graph Journal Lines"
begin
JournalName := LibraryUtility.GenerateRandomCode(GenJournalBatch.FieldNo(Name), DATABASE::"Gen. Journal Batch");
LibraryAPIGeneralJournal.EnsureGenJnlBatchExists(GraphMgtJournal.GetDefaultVendorPaymentsTemplateName(), JournalName);
GenJournalBatch.Get(GraphMgtJournal.GetDefaultVendorPaymentsTemplateName(), JournalName);

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\ —\ Performance}$

CreateVendorPaymentsJournal calls EnsureGenJnlBatchExists, which already performs a primary-key Get for this template and batch, and then immediately performs the same Get again before checking No. Series. This adds an avoidable database round trip on every helper call; return or pass through the record loaded by the ensure helper, or otherwise combine the existence check and No. Series update into one lookup.

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

if GenJournalBatch."No. Series" = '' then begin
GenJournalBatch.Validate("No. Series", LibraryERM.CreateNoSeriesCode());
GenJournalBatch.Modify(true);
end;
exit(JournalName);
end;

Expand Down
Loading