web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Not Allow to post Invoice directly from Purchase Order

(0) ShareShare
ReportReport
Posted on by 307

How can I set up to not allow to post Invoice directly from Purchase Order ?

pastedimage1678938307907v2.png

Or if there is no function to set up, which action should I modify in AL code ?

Thank you.

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,790 Moderator on at

    There are many thing to achieve your requirement, some are below.

    1. No to enter Qty. to Invoice field value

    2. Put the error if someone does for point no. 1

    3. Put an error on Point No. 1

    4. Disable the Invoice menu option by going to Codeunit 91

    5. Put your logic on OnBeforePosting, in codeunit 90

    Thanks.

  • Suggested answer
    Mohana Yadav Profile Picture
    61,200 Super User 2026 Season 1 on at

    You can do it multiple ways

    1st code will just show the Receive option

        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post (Yes/No)", 'OnBeforeSelectPostOrderOption', '', false, false)]
        local procedure OnBeforeSelectPostOrderOption(var PurchaseHeader: Record "Purchase Header"; DefaultOption: Integer; var Result: Boolean; var IsHandled: Boolean);
        var
            ReceiveInvoiceQst: Label '&Receive';
            Selection: Integer;
        begin
            IsHandled := true;
            Selection := StrMenu(ReceiveInvoiceQst, DefaultOption);
            if Selection = 0 then
                Result := false;
            PurchaseHeader.Receive := Selection in [1, 3];
            PurchaseHeader.Invoice := Selection in [2, 3];

            Result := true;
        end;
    pastedimage1678941670651v1.png

    2nd code will throw error if user selects Invoice or "Receive and Invoice"


        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post (Yes/No)", 'OnAfterConfirmPost', '', false, false)]
        local procedure OnAfterConfirmPost(var PurchaseHeader: Record "Purchase Header");
        var
            InvErr: Label 'Posting Invoice is not allowed from Purchase Order.';
        begin
            if PurchaseHeader.Invoice then
                Error(InvErr);
        end;
    pastedimage1678941687823v2.png
  • Hoang Ng Profile Picture
    307 on at

    Thanks Yadav,

    I am sorry for late response.

    I used your 1st code and It showed as expected.

    pastedimage1679477875255v1.png

    But there is a small confusing that when I clicked Cancel it showed the error:

    "Please enter "Yes" in Receive and/or Invoice and/or Ship"

    pastedimage1679477959228v2.png

    Do you know whether this error message impact anything or just only "info" ?

    Thanks

  • Suggested answer
    Mohana Yadav Profile Picture
    61,200 Super User 2026 Season 1 on at

    yes, it is standard info.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,822 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,136 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 956 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans