Create Payment for sales invoice - Server error

Hi everybody ,
am using
ERPNext: v13.7.1 (version-13)
Frappe Framework: v13.7.0 (version-13)
whenever I try to “create payment” for a sales invoice for a patient, I receive this error:
Server Error
NameError: name ‘previous_payment_entry’ is not defined

Any Help to resolve this issue please… thank you.

special customized sales invoice for contracting industry removed and it is ok