local procedure InitDeferralCode()
var
Item: Record Item;
IsHandled: Boolean;
ShouldUpdateDeferralCode: Boolean;
begin
IsHandled := false;
OnBeforeInitDeferralCode(Rec, IsHandled);
if IsHandled then
exit;
ShouldUpdateDeferralCode := SalesLine."Document Type" in [SalesLine."Document Type"::Order, SalesLine."Document Type"::Invoice, SalesLine."Document Type"::"Credit Memo", SalesLine."Document Type"::"Return Order"];
OnBeforeUpdateDeferralCode(SalesLine, ShouldUpdateDeferralCode);
if ShouldUpdateDeferralCode then
case Type of
Type::"G/L Account":
Validate("Deferral Code", GLAcc."Default Deferral Template Code");
Type::Item:
begin
GetItem(Item);
Validate("Deferral Code", Item."Default Deferral Template Code");
end;
Type::Resource:
Validate("Deferral Code", Res."Default Deferral Template Code");
end;
end;
Additional context
Could this function be made like this?
I need this because i want to also set the deferral code when the document type is quote. I know i can use the onbeforeinitdeferralcode, but i thought it would be smoother with event OnBeforeUpdateDeferralCode
Describe the request
Additional context
Could this function be made like this?
I need this because i want to also set the deferral code when the document type is quote. I know i can use the onbeforeinitdeferralcode, but i thought it would be smoother with event OnBeforeUpdateDeferralCode