-
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 "Purchase Line" with all required fields and pass it to PrepareLine procedure without actually inserting "Purchase Header" or "Purchase Line".
Everything works fine apart of procedure UpdateEntryDescriptionFromPurchaseLine, because code is trying to read "Purchase Header" record from database:
PurchaseHeader.get(PurchaseLine."Document Type", PurchaseLine."Document No.");
PS. Similar issue exist on sales side.
Describe the request
codeunit 826 "Purch. Post Invoice Events"
{
///OD
internal procedure RunOnUpdateEntryDescriptionFromPurchaseLine(PurchaseLine: Record "Purchase Line"; var InvoicePostingBuffer: Record "Invoice Posting Buffer"; var IsHandled: Boolean)
begin
OnUpdateEntryDescriptionFromPurchaseLine(PurchaseLine, InvoicePostingBuffer, IsHandled);
end;
[IntegrationEvent(false, false)]
local procedure OnUpdateEntryDescriptionFromPurchaseLine(PurchaseLine: Record "Purchase Line"; var InvoicePostingBuffer: Record "Invoice Posting Buffer"; var IsHandled: Boolean)
begin
end;
}
codeunit 816 "Purch. Post Invoice" implements "Invoice Posting"
{
local procedure UpdateEntryDescriptionFromPurchaseLine(var PurchaseLine: Record "Purchase Line"; var InvoicePostingBuffer: Record "Invoice Posting Buffer")
var
PurchaseHeader: Record "Purchase Header";
IsHandled: Boolean;
begin
//OD >>
IsHandled := false;
PurchPostInvoiceEvents.RunOnUpdateEntryDescriptionFromPurchaseLine(PurchaseLine, InvoicePostingBuffer, IsHandled);
if IsHandled then
exit;
//OD <<
...
end;
}