Steps to reproduce
remove docker containers
start local instance of ref distro (last commit: bb07a534111cdf87a447bf7c6e26442e8a2fb938)
log as administrator
(without changes) submit, authorize and approve a requisition for Comfort Health Clinic, Family Planning and Apr2017
Enable Date Physical Stock Count Completed field in the requisition template for Family Planning
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)
(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
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)
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:
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)
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)
The validation for SoH in Stock management now fails when attempting to approve this requisition
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:
Troubleshoot to find where is the bug
user should be able to approve the emergency/middle period requisition from reproduction steps without error messages.
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:
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?
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.
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):
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.
No remaining issues that we are aware of on the Malawi side.
Marking as Dead (this bug was fixed by ).
Filed Bug to follow up investigating the display issue in the comments above.