ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Codeunit 80 "Sales-Post" - Function "InsertPostedHeaders" - OnBeforeInsertPostedHeaders extend Event with IsHandled

Open SWE-Tina opened this issue 5 years ago • 2 comments

As we need to skip the Shipment block due to rental documents that aren't posted with shipping but normal invoiced as sales documents, we need the IsHandled already in the "OnBeforeInsertPostedHeaders" as additional parameter and the shipment-block extend to "if Ship and (not isHandled) then begin if ("Document Type" = "Document Type"::Order) or (("Document Type" = "Document Type"::Invoice) and SalesSetup."Shipment on Invoice"

image

SWE-Tina avatar Dec 07 '20 14:12 SWE-Tina

Extension of existing event "OnBeforeInsertPostedHeaders" ` [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnBeforeInsertPostedHeaders', '', true, true)] local procedure "Sales-Post_OnBeforeInsertPostedHeaders" ( var SalesHeader: Record "Sales Header"; var TempWarehouseShipmentHeader: Record "Warehouse Shipment Header"; var TempWarehouseReceiptHeader: Record "Warehouse Receipt Header"; var IsHandled: Boolean ) begin

end;

`

and change function to: `local procedure InsertPostedHeaders(var SalesHeader: Record "Sales Header") var SalesShptLine: Record "Sales Shipment Line"; PurchRcptLine: Record "Purch. Rcpt. Line"; GenJnlLine: Record "Gen. Journal Line"; PostingPreviewEventHandler: Codeunit "Posting Preview Event Handler"; IsHandled: Boolean; begin if PreviewMode then PostingPreviewEventHandler.PreventCommit();

    OnBeforeInsertPostedHeaders(SalesHeader, TempWhseShptHeader, TempWhseRcptHeader);

    with SalesHeader do begin
        // Insert shipment header
        if Ship **and (not isHandled)** then begin`

SWE-Tina avatar Dec 08 '20 12:12 SWE-Tina

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. We will update this issue with information about availability. 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.

JesperSchulz avatar Dec 09 '20 16:12 JesperSchulz