Error when sending data to stock management, prevents Requisition approval

Description

Steps to reproduce

  1. remove docker containers

  2. start local instance of ref distro (last commit: bb07a534111cdf87a447bf7c6e26442e8a2fb938)

  3. log as administrator

  4. (without changes) submit, authorize and approve a requisition for Comfort Health Clinic, Family Planning and Apr2017

  5. Enable Date Physical Stock Count Completed field in the requisition template for Family Planning

  6. submit, authorize and approve a requisition for Comfort Health Clinic, Family Planning and May2017 with 07/11/2017 as Date Physical Stock Count Completed (skip all products without C100 - Levora, set beginning balance = 45, received = 10, consumed = 10, losses = 0, stockout = 0)

  7. (without changes) reject, submit, authorize and approve a requisition for Comfort Health Clinic, Family Planning and Mar2017 with 06/11/2017 as Date Physical Stock Count Completed

  8. initiate, submit, authorize and approve an emergency requisition for Comfort Health Clinic, Family Planning and Nov2017 with 05/11/2017 as Date Physical Stock Count Completed (skip all products without C100 - Levora, set beginning balance = 0, received = 1, consumed = 1, losses = 0, stockout = 1)

    1. Note You may have to revise Step 8 to use a Regular, not an Emergency requisition, because now only Regular Requisitions will send data to a stock card because of Emergency Requisitions redesign.

More general steps to reproduce:

  1. Have two requisitions approved and reported their current balance to the stock management service, such that:
    a) There's a gap of at least one period between those requisitions (eg. requisition for March and May with monthly schedule)
    b) The SoH of a one chosen product for earlier requisition is bigger (eg 100) than than the SoH for the respective product in the latter one (eg 80)

  2. Create & approve another requisition, for a period between the two requisitions above (in our example - April). You already needed to Initiate, Submit and Authorize this one (eg April) in the previous step in order to initiate the later one (eg May); but this middle one should not yet be Approved. Now make sure that the SoH for the same product as above in this requisition is set to a smaller amount than the difference of SoH for the requisitions above (eg. SoH for March = 100, SoH for May = 80; 100-80=20; set SoH to anything below 20)

  3. The validation for SoH in Stock management now fails when attempting to approve this requisition

  4. The same can be achieved using regular requisitions, emergency requisitions, setting/not setting manual date of physical stock count completed, etc. The only requirements are that there's a gap between those dates where we can insert new entry and that there's a negative adjustment in stock management between those two dates. This is also visualized below:

Acceptance criteria

  • Troubleshoot to find where is the bug

  • user should be able to approve the emergency/middle period requisition from reproduction steps without error messages.

Environment

None

Activity

Show:
Brandon Bowersox-Johnson
March 2, 2018, 12:02 AM

I attempted to reproduce this now that is fixed, and I can no longer reproduce this Bug. The fix in allows me to go through all Steps to Reproduce without the error. Yay!
Note that I had to revise Step 8 to use a Regular, not an Emergency requisition, because now only Regular Requisitions will send data to a stock card.

Because I can no longer reproduce, I propose moving this ticket to Dead and marking it Solved by OLMIS-3808. Before I do, I want your input on 1 question:

  1. With 3808 fixed and 3505 also solved, do you have any remaining concerns that this issue is still going to be a problem for the Malawi implementation?

FYI

Brandon Bowersox-Johnson
March 2, 2018, 12:17 AM
Edited

Side note about reproducing this bug:

Following the Steps to Reproduce does not generate the error any more. User can submit all requisitions just fine. Below is screenshot showing Stock On Hand page after all the steps are completed successfully:

Note: Some of the calculations on the Stock On Hand view look wrong to me--they subtract in the wrong order. So I will likely file a separate bug about that so we can address it.

Paweł Albecki
March 2, 2018, 11:23 AM
Edited

It doesn't make sense. It should always calculate properly no matter if PI is submit out of order. Let's say I submit PI with SOH 100 for January and then for March SOH 40 (which is saved in database as adjustment quantity -60) and for April 210 (170 in database). Now, I submit for February SOH 200 and provide adjustment -20 and +10 (saved in db as -10). And then on SOH view we have (from bottom to top):

Month

Adjustment

SOH

January

100

100

February

10

110

February

-20

90 (100

  • 10

)

March

-60

30 (90

  • 60

)

April

170

200 (30 + 170)

It require more investigation what is going on with Physical Inventory submit by Requisition.

What is really weird that in Brandon screen of SOH page, between 5/11 and 6/11 it shows difference SOH 50 but sum of discrepancy adjustments is 5.

Sebastian Brudziński
March 2, 2018, 1:30 PM

No remaining issues that we are aware of on the Malawi side.
cc

Brandon Bowersox-Johnson
March 2, 2018, 11:43 PM
Edited

Marking as Dead (this bug was fixed by ).

Filed Bug to follow up investigating the display issue in the comments above.

Assignee

Unassigned

Reporter

Paweł Albecki

Labels

Story Points

8

Time tracking

0m

Time remaining

1h 30m

Epic Link

Components

Priority

Critical
Configure