Payment entry and payment request issue in Purchase invoice

Hello Developers,

Found a bug…!!!

created a partial payment against PO by requesting payment request, once the payment entry is done, I’m trying to make the rest payment as well. here the amount is not showing which required to, but it’s calculated double of first partial payment and substracted from full invoice and showing the rest of amount.

and are in cases it moving to negative values also.

Ex: case 1: PO of 1000

first partial pay from payment request is and payment entry as 500.
when I’m trying to pay rest amount from payment request the amount is showing as 0. where it should be 500.

case 2: PO of 1000.

first partial pay from payment request is and payment entry of 700 is done.
when I’m trying to pay rest amount from payment request the amount is showing as -400. where it should be 300

Just Comment this snippet
if existing_payment_request_amount:
grand_total -= existing_payment_request_amount
in {make_payment_request} method available in path erpnext/erpnext/accounts/doctype/payment_request/payment_request.py