[Event Request] CU 80 Sales Post
Hello, I would like to modfiy function FillInvoicePostingBuffer and move eisting events like this: ` //mod IsHandled := not (SalesSetup."Discount Posting" in [SalesSetup."Discount Posting"::"Invoice Discounts", SalesSetup."Discount Posting"::"All Discounts"]); OnBeforeCalcInvoiceDiscountPosting( TempInvoicePostBuffer, InvoicePostBuffer, SalesHeader, SalesLine, TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY, IsHandled); if not IsHandled then begin // end CalcInvoiceDiscountPosting(SalesHeader, SalesLine, SalesLineACY, InvoicePostBuffer); if (InvoicePostBuffer.Amount <> 0) or (InvoicePostBuffer."Amount (ACY)" <> 0) then begin IsHandled := false; OnFillInvoicePostingBufferOnBeforeSetInvDiscAccount(SalesLine, GenPostingSetup, InvDiscAccount, IsHandled); if not IsHandled then InvDiscAccount := GenPostingSetup.GetSalesInvDiscAccount; InvoicePostBuffer.SetAccount(InvDiscAccount, TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY); InvoicePostBuffer.UpdateVATBase(TotalVATBase, TotalVATBaseACY); UpdateInvoicePostBuffer(TempInvoicePostBuffer, InvoicePostBuffer, true); end; end;
// mod
IsHandled := not (SalesSetup."Discount Posting" in
[SalesSetup."Discount Posting"::"Invoice Discounts", SalesSetup."Discount Posting"::"All Discounts"]);
OnBeforeCalcLineDiscountPosting(
TempInvoicePostBuffer, InvoicePostBuffer, SalesHeader, SalesLine, TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY, IsHandled);
if not IsHandled then begin
CalcLineDiscountPosting(SalesHeader, SalesLine, SalesLineACY, InvoicePostBuffer);
if (InvoicePostBuffer.Amount <> 0) or (InvoicePostBuffer."Amount (ACY)" <> 0) then begin
IsHandled := false;
OnFillInvoicePostingBufferOnBeforeSetLineDiscAccount(SalesLine, GenPostingSetup, LineDiscAccount, IsHandled);
if not IsHandled then
LineDiscAccount := GenPostingSetup.GetSalesLineDiscAccount;
InvoicePostBuffer.SetAccount(LineDiscAccount, TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY);
InvoicePostBuffer.UpdateVATBase(TotalVATBase, TotalVATBaseACY);
UpdateInvoicePostBuffer(TempInvoicePostBuffer, InvoicePostBuffer, true);
OnFillInvoicePostingBufferOnAfterSetLineDiscAccount(SalesLine, GenPostingSetup, InvoicePostBuffer, TempInvoicePostBuffer);
end;
end;
`
these would allow to perform calculations on custom discount postings types. Thanks, Bartek
Hi @BWilczewski . We cannot move events. Instead, we could do something like this:

Is it ok for you? If yes, please specify the needed parameters for events OnAfterCalcInvoiceDiscountPosting/OnAfterCalcInvoiceDiscountPosting
Hey @RomanZanizdra, thanks for the input, mod fits my needs, sales header and sales line parameters will be fine.
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.