Cannot generate an invoice for an order that was not completely paid

Hello,

I have a sales order whose total amount is $ 500.000. I have generated an invoice some days ago for an advance payment of $ 250.000.

Now, I need to invoice the remainder, however, the sales order does not allow me to create an invoice. Instead, the sales order appears as completed. Even more strange, the payment graph appears that the sales order was 100% invoiced. How could this be possible and more importantly, how can I solve it or should I generate a manual invoice not linked to a sales order?

Thanks

Installed Apps

ERPNext: v12.24.0 (version-12)

Frappe Framework: v12.21.0 (version-12)

P.S. Please don’t suggest me to upgrade ERPNext.

EDIT:

To generate that advance payment, I have invoiced the sales order with 50% of discount. Could this be the reason? is there a way to fix this?

Regards
Jaime