Reaching out to see if anyone has had a similar situation: Intermittently when applying customer payments in Us Dollars (LCY) against invoices in Foreign Currency (EUR) when there are more than one ,when there is a payment tolerance, we recieve the Payment Tolerance Warning and if we say to apply it as a payment tolerance, one of 2 things occurs
1) either we receive a divide by zero error
2) the system frreezes up and we have to end the sesssion
 
I have traced the issue to:
codeunit 426 "Payment Tolerance Management"
 
local procedure PutCustPmtTolAmount(CustledgEntry: Record "Cust. Ledger Entry"; Amount: Decimal; AppliedAmount: Decimal; CustEntryApplID: Code[50])
 
On line 1031 - This is the divide by zero error where total amount is zero
AcceptedEntryTolAmount := Round((AppliedCustLedgEntry.Amount / TotalAmount) * AcceptedTolAmount);
 
It seems to be an issue with the loop on line 1013
f AppliedCustLedgEntry.FindSet(true) then
 
for some reason when : AppliedCustLedgEntry.Modify(); is run and then the
until AppliedCustLedgEntry.Next() = 0;  doesnt seem to adnace the record?  This either results in a divide by zero or and endless loop
 
It doesn't appear this codeunit was changed recently - Any guidance would be very helpful as I have been going down the rabbit hole of payment tolerance management with no success