Number Sequence for PO Invoice Voucher

Hi All,

I just want to know where number sequence for ("Purchase, inventory receipt ") and (“Purchase expenditure for product”) will be taken in code while we post Purchase Invoice… i.e Invoice → voucher → 5 vouchers will be created and among 5, voucher number sequence for Purchase, inventory receipt and Purchase expenditure for product , where we have to define in the set up and which class , method is used to pick the Number sequence??

Any help regarding this will be highly appreciated

Thanks and Regards,


What’s your version of AX?

Hi Martin ,

It was Ax 2012 R2 …

In the screen shot you can see the first 3 vouchers having same number sequence. But the last two are having different one. So your help is urgently required … Thanks in advance for your reply



You should find what you need in PurchInvoiceJournalCreate.allocateNumAndVoucher().

Hi Martin ,

I even know that class is used for voucher number sequences, but only for the first three entries , number sequence has been picked from that method… But for the last two entries, number sequence has been picked from some where else. Since I debugged that class , invoice number and invoice voucher has been picked only once and has been assigned to the first three entries of that journal. But for last two entries , it is not coming from that class … I even know that it has been picked from Inventory parameters → Number sequence → cost voucher … But in code level , I cant able to find … Requesting for your help

Thanks and Regards,


Hey Enrique , I am facing the same issue , Please share solution if you get it.

That is costing ledger voucher posted from the sub ledger.

You need to look at \Classes\PurchInvoiceJournalCreate\getCostLedgerVoucher

hi kranthi,

Thanks for quick reply. I want to keep the same number sequence for last two records. pls suggest.

In this method \Classes\PurchInvoiceJournalCreate\getCostLedgerVoucher there is a condition check whether to use a single voucher. You should be able to debug and find out the same.

Hi Kranthi

Thank you , I got my desire output.

// below code was checking for single voucher

return voucher;
then I went to
SourceDocumentCompletionRule/ checkRuleCondition()

As I am working in INMF company so I just commented India from If condition

if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoRU]) ||
// SysCountryRegionCode::isLegalEntityInCountryRegion([#isoIN]) || (Commented code for INMF)
canPostSingleVoucher = false;
canPostSingleVoucher = true;

return canPostSingleVoucher;