ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] OnInitSourceDocumentHeaderOnBeforeReopenSalesHeader - codeunit 5763 "Whse.-Post Shipment"

Open innonav-dev opened this issue 4 years ago • 1 comments

Could you please extend the Event OnInitSourceDocumentHeaderOnBeforeReopenSalesHeader by the variable SkipCalledFromWhseDoc?

codeunit 5763 "Whse.-Post Shipment"

We need this in order to get the behaviour from BC17.

local procedure InitSourceDocumentHeader()
var
    SalesRelease: Codeunit "Release Sales Document";
    PurchRelease: Codeunit "Release Purchase Document";
    ReleaseServiceDocument: Codeunit "Release Service Document";
    ModifyHeader: Boolean;
    ValidatePostingDate: Boolean;
    IsHandled: Boolean;
    SkipCalledFromWhseDoc: Boolean; --> new
begin
    OnBeforeInitSourceDocumentHeader(WhseShptLine);

    with WhseShptLine do
        case "Source Type" of
            DATABASE::"Sales Line":
                begin
                    IsHandled := false;
                    OnInitSourceDocumentHeaderOnBeforeValidatePostingDate(SalesHeader, WhseShptLine, ValidatePostingDate, IsHandled, ModifyHeader);
                    if not IsHandled then
                        if (SalesHeader."Posting Date" = 0D) or
                        (SalesHeader."Posting Date" <> WhseShptHeader."Posting Date") or ValidatePostingDate
                        then begin
			//OnInitSourceDocumentHeaderOnBeforeReopenSalesHeader(SalesHeader, Invoice);  --> original
                            OnInitSourceDocumentHeaderOnBeforeReopenSalesHeader(SalesHeader, Invoice, SkipCalledFromWhseDoc);  --> new
                            SalesRelease.Reopen(SalesHeader);
                            SalesRelease.SetSkipCheckReleaseRestrictions;
                            SalesHeader.SetHideValidationDialog(true);
			// NEW +++
                            if not SkipCalledFromWhseDoc then
			// NEW ---
                                SalesHeader.SetCalledFromWhseDoc(true);
                            SalesHeader.Validate("Posting Date", WhseShptHeader."Posting Date");


[IntegrationEvent(false, false)]
local procedure OnInitSourceDocumentHeaderOnBeforeReopenSalesHeader(var SalesHeader: Record "Sales Header"; Invoice: Boolean; var SkipCalledFromWhseDoc: Boolean)
begin
end;

innonav-dev avatar Apr 14 '22 07:04 innonav-dev

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. 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 Apr 20 '22 04:04 JesperSchulz