microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
783 stars 620 forks source link

[Event Request] Codeunit 12 "Gen. Jnl.-Post Line" - OnInitGLEntryVATCopyOnBeforeSummarizeVAT #27010

Closed RZ440 closed 1 month ago

RZ440 commented 2 months ago

Describe the request

In the Event Request #26832 we asked for a new event OnInitGLEntryVATCopyOnBeforeSummarizeVAT in Codeunit 12 "Gen. Jnl.-Post Line".

    procedure InitGLEntryVATCopy(GenJnlLine: Record "Gen. Journal Line"; AccNo: Code[20]; BalAccNo: Code[20]; Amount: Decimal; AmountAddCurr: Decimal; VATEntry: Record "VAT Entry"): Integer
    var
        GLEntry: Record "G/L Entry";
    begin
        OnBeforeInitGLEntryVATCopy(GenJnlLine, GLEntry, VATEntry, NextEntryNo);
        InitGLEntry(GenJnlLine, GLEntry, AccNo, Amount, 0, false, true);
        GLEntry."Additional-Currency Amount" := AmountAddCurr;
        GLEntry."Bal. Account No." := BalAccNo;
        GLEntry.CopyPostingGroupsFromVATEntry(VATEntry);
        OnInitGLEntryVATCopyOnBeforeSummarizeVAT(GenJnlLine, GLEntry, VATEntry);
        SummarizeVAT(GLSetup."Summarize G/L Entries", GLEntry);
        OnAfterInitGLEntryVATCopy(GenJnlLine, GLEntry);

        exit(GLEntry."Entry No.");
    end;
    [IntegrationEvent(false, false)]
    local procedure OnInitGLEntryVATCopyOnBeforeSummarizeVAT(GenJournalLine: Record "Gen. Journal Line"; var GLEntry: Record "G/L Entry"; VATEntry: Record "VAT Entry")
    begin
    end;

Additional context

You rejected the request recommending to use OnAfterCopyGLEntryFromGenJnlLine(Rec, GenJnlLine) in CopyFromGenJnlLine called from InitGLEntry. We are using OnAfterCopyGLEntryFromGenJnlLine to fill additional fields that are to be set in all G/L Entries. But some fields we would like to set only in G/L Entries created in InitGLEntryVATCopy, but in InitGLEntry/CopyFromGenJnlLine/OnAfterCopyGLEntryFromGenJnlLine we do not know where it is called from. Internal work item: AB#544383

JesperSchulz commented 1 month ago

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: .