Skip to content

Fixes writeoff failure when amount in secondary currency is too small compared to company currency.

When you have a currency that the exchange rate is 1:520 as in dollars (USD) to Costa Rica colones(CRC), the PayInvoice wizard fails to complete by raising a ReconciliationError with a message that a writeoff was not selected even though it was selected by the user and the amount to write off is 0.01 CRC (secondary currency). This small amount converted to the company currency USD is 0.000019157, which is rounded off to basically zero.

The root cause of the problem is located in the update made in version 7.0 to account.move.line reconcile function where a exception is raised when no writeoff method is passed when there is writeoff amount. Reconcile is called in 2 places:

  1. During PayInvoice wizard where the writeoff method is passed to the function, which is working correctly.
  2. During the account.move post. This method looks for debit and credit lines that are zero in company currency to be passed to reconcile function, but when this happens, it detects that there is a writeoff amount (0.01 CRC) in secondary currency and hence raises the exception.

The solution in my opinion is to modify the account.move.line reconcile to proceed with a writeoff for the second currency only if there is also a writeoff amount in the company currency. This is what this merge request does.

Merge request reports