Event Request - OnBeforeUpdateInvoicePostingBufferLineDiscounts - codeunit 827 "Service Post Invoice Events"
Please could we have a OnBeforeUpdateInvoicePostingBufferLineDiscounts - codeunit 827 "Service Post Invoice Events", and call this from codeunit 817 "Service Post Invoice" implements "Invoice Posting" - PrepareLine.
codeunit 827 "Service Post Invoice Events" procedure RunOnBeforeUpdateInvoicePostingBufferLineDiscounts(var InvoicePostingBuffer: Record "Invoice Posting Buffer"; ServiceLine: Record "Service Line") begin OnBeforeUpdateInvoicePostingBufferLineDiscounts(InvoicePostingBuffer, ServiceLine) end;
[IntegrationEvent(false, false)]
local procedure OnBeforeUpdateInvoicePostingBufferLineDiscounts(var InvoicePostingBuffer: Record "Invoice Posting Buffer"; ServiceLine: Record "Service Line")
begin
end;
Then call from here codeunit 817 "Service Post Invoice" implements "Invoice Posting" procedure PrepareLine(DocumentHeaderVar: Variant; DocumentLineVar: Variant; DocumentLineACYVar: Variant) begin if SalesSetup."Discount Posting" in [SalesSetup."Discount Posting"::"Line Discounts", SalesSetup."Discount Posting"::"All Discounts"] then begin CalcLineDiscountPosting(InvoicePostingBuffer, ServiceLine, ServiceLineACY, ServiceHeader); if (InvoicePostingBuffer.Amount <> 0) or (InvoicePostingBuffer."Amount (ACY)" <> 0) then begin InvoicePostingBuffer.SetAccount( GenPostingSetup.GetSalesLineDiscAccount(), TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY); InvoicePostingBuffer.UpdateVATBase(TotalVATBase, TotalVATBaseACY); ServicePostInvoiceEvents.RunOnBeforeCalcInvoiceDiscountPosting(InvoicePostingBuffer, ServiceLine); UpdateInvoicePostingBuffer(InvoicePostingBuffer, ServiceLine); end; end;
Additional context
This will allow us to amend the Account used for Posting Line Discounts dependent on whether the contract is prepaid or not.
Sorry line in PrepareLine should read ServicePostInvoiceEvents.RunOnBeforeUpdateInvoicePostingBufferLineDiscounts(InvoicePostingBuffer, ServiceLine);
Hi, is there any update on this request? Many Thanks
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: 15512.