The posting of Purchase invoice happens at class named PurchInvoiceJournalPost
Please try to debug it there and focus on methods such as createCustVendLedgerVoucher and postCustVendPostLedgerVoucherEnd
You might be facing issue at debugging because the process may be running under CIL and AX would not be bale to help you in that case. such cases are debugged in VS by attaching AX32Server.Exe process. Also make sure if your server side debugging is enabled.