@dfakldjha Please check payment terms field is none value u pass on your custom code or script so fix that issue from your side then your error is resolve
In which doctype you can throw this error that doctype u can check doctype script
the error is in sales invoice