Listener called twice

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.

Hi,
You can set a breakpoint to the listener and try to find out when and why it is invoked.

Seems that is invoked when I open and when I close the window.
What is the condition to see if (invoice) edit window is closed?