Payment entry allocation incorrect

Hi
payment entry when i have an amount of 20,000 split in two payments , one a deposit and the other due for a later date. When the customer pays the deposit and i allocate the payment of 10,000 the system still shows outstanding as 20,000 on the documet print,pdf and email.
PaymentEntry
PaymentRow
However if i navigate to Accounting>SalesInvoice>the system has an invoice with status of unpaid with the correct amount unpaid.
ERPNext: v13.1.1 (version-13)
Frappe Framework: v13.1.2 (version-13)

ERPNext: v12.20.0 (version-12)
Frappe Framework: v12.17.0 (version-12)