Say Umair may recognize the biz case here?
Here’s another case Payment Entry has been modified after you pulled it
Here’s the actual code to ponder erpnext/utils.py at develop · frappe/erpnext · GitHub
and the code comments if they are accurate:
check if there is already a voucher reference
check if amount is same
check if jv is submitted
hope this helps