ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 131334 "ERM VAT Tool - Helper"

Open aobsgit opened this issue 5 years ago • 1 comments

Hi

Could you please add an integration event in CreateVATPostingSetup

procedure CreateVATPostingSetup(VATProdPostingGroup: Record "VAT Product Posting Group")
var
    VATPostingSetup: Record "VAT Posting Setup";
    ExistingVATPostingSetup: Record "VAT Posting Setup";
    VATPercent: Integer;
    isHandled: Boolean;
begin
    ExistingVATPostingSetup.SetFilter("Sales VAT Account", '<>''''');
    ExistingVATPostingSetup.SetFilter("Purchase VAT Account", '<>''''');
    LibraryERM.FindVATPostingSetup(ExistingVATPostingSetup, VATPostingSetup."VAT Calculation Type"::"Normal VAT");
    
    >>> NEW CODE
    OnBeforeCreateVATPostingSetup(VATPostingSetup, ExistingVATPostingSetup, isHandled);
    if isHandled then
        exit;
    <<< END

    VATPostingSetup.Init();
    VATPostingSetup.Validate("VAT Prod. Posting Group", VATProdPostingGroup.Code);
    VATPostingSetup.Validate("VAT Bus. Posting Group", ExistingVATPostingSetup."VAT Bus. Posting Group");
    VATPercent := LibraryRandom.RandInt(30);
    VATPostingSetup.Validate("VAT Identifier", 'VAT' + Format(VATPercent));
    VATPostingSetup.Validate("VAT %", VATPercent);
    VATPostingSetup.Validate("Sales VAT Account", ExistingVATPostingSetup."Sales VAT Account");
    VATPostingSetup.Validate("Purchase VAT Account", ExistingVATPostingSetup."Purchase VAT Account");
    VATPostingSetup.Insert(true);
end;

>>> NEW CODE
[IntegrationEvent(false, false)]
local procedure OnBeforeCreateVATPostingSetup(var VATPostingSetup: Record "VAT Posting Setup"; var ExistingVATPostingSetup: Record "VAT Posting Setup"; var isHandled: Boolean)
begin
end;
<<< END

aobsgit avatar Feb 15 '21 15:02 aobsgit

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. We will update this issue with information about availability. 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.

JesperSchulz avatar Feb 20 '21 07:02 JesperSchulz