Bypass validation during Stock ledger Entry

Hi
So, due to some reason with the categorising in stock reconciliation doctype, I have to make a new doctype similar to stock reconciliation. I did that, and also wrote a script to create new stock ledger entry,

But the moment I try submitting this new document, I get a validation error ‘frappe.exceptions.LinkValidationError: Could not find Voucher No: MAT-RECO-2023-00009’ , even though the entry is done.
Can anyone tell me what I did wrong and what is the way to bypass this validation error