When we post Purchase Order P-01807, we get an error "Purchase Invoice 120413 already exist", but when looking at the posted purchase invoices we do not see 120413 in the table.
We've already turned off Mandatory External Document checking for both Sales & Receivables and in Purchase & Payables Setup?
It is breaking on this part of the code:
Hi Nav_admin, It doesn't matter if "Ext. Doc. No. Mandatory" have been set or not. If the external document no. 120413 has been used once by this vendor, then you cannot use it again.
If you scroll up a few lines from where you debugger is, then you will see the whole code block:
// Check External Document number
IF PurchSetup."Ext. Doc. No. Mandatory" OR
(GenJnlLineExtDocNo <> '')
VendLedgEntry.SETCURRENTKEY("External Document No.");
VendLedgEntry.SETRANGE("External Document No.",GenJnlLineExtDocNo);
VendLedgEntry.SETRANGE("Vendor No.","Pay-to Vendor No.");
IF VendLedgEntry.FINDFIRST THEN