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

Assignee

Unassigned

Reporter

Paweł Albecki

Labels

Story Points

8

Time tracking

8h

Epic Link

Components

Priority

Critical
Configure