-
Notifications
You must be signed in to change notification settings - Fork 692
Description
Why do you need this change?
We are using "Invoice Posting" interface to post custom (Trade) documents.
In our code we populate "Sales Line" with all required fields and pass it to PrepareLine procedure without actually inserting "Sales Header" or "Sales Line".
Everythign works fine apart of procedure UpdateEntryDescriptionFromSalesLine, because code is trying to read "Sales Header" record from database:
SalesHeader.Get(SalesLine."Document Type", SalesLine."Document No.");
PS. Similar issue exist on purchase side.
Describe the request
codeunit 825 "Sales Post Invoice Events"
{
///OD
internal procedure RunOnUpdateEntryDescriptionFromSalesLine(SalesLine: Record "Sales Line"; var InvoicePostingBuffer: Record "Invoice Posting Buffer"; var IsHandled: Boolean)
begin
OnUpdateEntryDescriptionFromSalesLine(SalesLine, InvoicePostingBuffer, IsHandled);
end;
[IntegrationEvent(false, false)]
local procedure OnUpdateEntryDescriptionFromSalesLine(SalesLine: Record "Sales Line"; var InvoicePostingBuffer: Record "Invoice Posting Buffer"; var IsHandled: Boolean)
begin
end;
}
codeunit 815 "Sales Post Invoice" implements "Invoice Posting"
{
local procedure UpdateEntryDescriptionFromSalesLine(SalesLine: Record "Sales Line"; var InvoicePostingBuffer: Record "Invoice Posting Buffer")
var
SalesHeader: Record "Sales Header";
IsHandled: Boolean;
begin
//OD >>
IsHandled := false;
SalesPostInvoiceEvents.RunOnUpdateEntryDescriptionFromSalesLine(SalesLine, InvoicePostingBuffer, IsHandled);
if IsHandled then
exit;
//OD <<
}