In standard Business Central, the invoice number is strictly controlled by the No. Series defined in the Sales & Receivables Setup and assigned on the Sales Header. Business Central does not support manual invoice numbering during posting due to audit trail and data integrity constraints.
However, to achieve what you're asking — assigning the invoice number programmatically based on the Customer PO No. — you'd need to:
1. Create a customization in AL.
2. Use the OnBeforeInsertSalesInvoiceHeader event in the Codeunit 80 "Sales-Post" to override the No. field before the invoice is created.
3. Validate that the number you assign does not conflict with existing entries and aligns with any required number series settings.
Keep in mind:
You might face restrictions when trying to bypass the No. Series enforcement.
Doing this can break future posting and integration logic (like e-invoicing or audit expectations).
A safer alternative is to keep the standard number, but include the Customer PO No. prominently in the external document number or description field on the invoice.
✅ Mark this answer as verified if it helps you.