Skip to content

[Event Request] codeunit 816 "Purch. Post Invoice", procedure UpdateEntryDescriptionFromPurchaseLine #29857

@grygoryshchakr

Description

@grygoryshchakr

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe issue misses information that prevents it from completion.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions