Skip to content

[Event Request] codeunit 815 "Sales Post Invoice", procedure UpdateEntryDescriptionFromSalesLine #29856

@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 "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 <<

}

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