steps to reproduce:
1. Create Invoice (Vendor) >> AP Credit memo, Payment Rule=Cash, add charge for 100 USD
2. Complete invoice>> idempiere creates Payment
3. Open Related Payment, payment doctype= AP Payment and amount is 100 USD
BUG: Invoice has been overpaid in actual behaviour instead allocate balance to 0.
*Solution: *AP payment must have negative sign. so in my example payment must be created as AP Payment amount -100.