Create an invoice with Payment term as 2% 10 Net 30 and grand total is say 237.50
Create Payment and select invoice created in #1, it will populate payment amount as 232.75 and discount amount as 4.75.
Change the payment amount from 232.75 to 10. However discount amount would be not updated and would be still at 4.75
Complete this payment with payment amount as 10 and discount as 4.75
Again create new payment for invoice in #1, payment amount would be 218 and discount amount would be 4.75
Here while calculating discount, system doesn't consider payment amount and based on invoice grand total amount and not even invoice open amount, it calculates discount.
Performed above scenario in https://test.idempiere.org/webui/
I believe discount should be calculated based on the amount of payment and not based on the invoice grand total.
Hi , I committed a fix but with a different approach, if the payment is not full then it doesn't give a discount. Discount can still be fill manually.
Fix looks good, if anyone is paying required invoice amount then only discount should apply otherwise if user wants to give discount on partial payment they can by updating discount field.
I am still evaluating with different business scenario with this fix.