I noted a bug with this long time ago but couldn't contribute it back. Check
the method getBillingAccountBalance() on BillingAccountWorker class & look
specifically at the code.
[snip]
List<GenericValue> paymentAppls =
delegator.findByAnd("PaymentApplication", UtilMisc.toMap("billingAccountId",
billingAccountId));
// TODO: cancelled payments?
for (Iterator<GenericValue> pAi = paymentAppls.iterator();
pAi.hasNext();) {
GenericValue paymentAppl = pAi.next();
if (paymentAppl.getString("invoiceId") == null) {
BigDecimal amountApplied =
paymentAppl.getBigDecimal("amountApplied");
balance = balance.add(amountApplied);
}
}
[snip]
The return invoice should be excluded from the check // if
(paymentAppl.getString("invoiceId") == null) and doing so the balance on
billing account should correctly populate.
Regards
Vikas
On Apr 26, 2012, at 10:10 AM, Anil Savani wrote:
> Now what action should be done for the return on the given billing account
> Either it should credit the full amount to the billing account to be used
> by other orders