Hello,
I have a listener that apparently is called twice .
Instead to have the price divided with 1.5, I have the price divided with 1.5x1.5 = 2.25.
Please advise.
@Override
public void init(Map<String, Object> params) {
linesDs.addCollectionChangeListener(e -> calculateAmount());
}
else if(item.getCurrency() ==InvCurrencyEnum.eur){
BigDecimal d = new BigDecimal(1.5);
BigDecimal amount = BigDecimal.ZERO;
for (InvoiceLine line : linesDs.getItems()){
BigDecimal x = line.getDescription().getPrice();
line.getDescription().setPrice(x.divide(d, 2, RoundingMode.CEILING));
amount = amount.add(line.getDescription().getPrice().multiply(line.getQuantity()));
getItem().setAmount(amount);
}
}
linesDs is nested in invoiceDs.
If I use invoiceDs.addItemChangeListener everything is fine.