Uploaded image for project: 'mod-finance-storage'
  1. mod-finance-storage
  2. MODFISTO-280

Budget encumbrance calculation can be wrong with negative pending payments

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • P1
    • Resolution: Done
    • None
    • 8.0.3
    • Standard Bug Write-Up Format
    • ACQ Sprint 130
    • 2
    • Thunderjet
    • Kiwi (R3 2021) Hot Fix #1
    • Lack of testing

    Description

      Overview:

      The issue is described in MODINVOICE-346, but the root of the issue is in mod-finance-storage. It occurs when there are several pending payments created by an invoice approval, and at least one at the end has a negative amount.

      The issue is in PendingPaymentService#updateBudgetsTotalsWithLinkedPendingPayments. In particular, applyPendingPayments calculates the new encumbrance by taking the maximum of 0 and encumbered - amount. This was probably not taking negative amounts into account.

      In the example given in MODINVOICE-346, the calculation of the new budget encumbrance is as follows:

      first pending payment: max(0, 10 - 10) = 0

      second: max(0, 0 - 10) = 0

      third: max(0, 0-(-10)) = 10

      order line encumbrance (the amount is 0 at this point because it was already released): 10 - 0 = 10

      But the result should be 0...

      Steps to Reproduce:

      See MODINVOICE-346.

      Expected Results:
      Actual Results:
      Additional Information:
      URL:
      Interested parties:

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                siarhei_hrabko Siarhei Hrabko
                damieng Damien Guillaume
                Dennis Bridges Dennis Bridges
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases