Apply Adjustment Reason to Adjustment quantity

Description

As a storeroom manager I want to be able to apply a reason for any adjustments I make to my stock within the requisition form so that I have a record of why I made that adjustment. I will get the field to do this whenever my admin/implementer has configured the Total Losses/Adjustments (D) field in the requisition template for my program.

Note: This is an API ticket to make the Requisitions API work properly with this field. This ticket depends on the configuration work from OLMIS-815. This ticket will provide the API necessary for the end-user UI that will be built in OLMIS-1068.

Acceptance Criteria
Verify that:

  • When I initiate a new requisition for a program that uses the Total Losses/Adjustments (D) field, that the field is used in the requisition in the proper sort order AND with the proper stock adjustment reasons that were configured in OLMIS-381. In other words, when I POST to the /requisitions/initiate API for a program whose template uses field D, then the resulting requisition has field D in the right sort order and connected to configured list of adjustment reasons.

  • When I GET this new requisition from the /requisitions/{id} API it will have each line item containing the Total Losses/Adjustments (D) field, and furthermore some API will provide all the available choices for stock adjustments that were configured as specified in OLMIS-381. So that API will show me the possible reasons, names, descriptions, sort orders (integer), and increment/decrement boolean.

  • * appropriate endpoint and logic is created to surface list of reasons from reference data /requisitions/lossAndAdjustments/reference­data

  • * RAML will be updated to show how these possible reasons are exposed, and Schemas will be added to the RAML for /requisitions/{id} and any other RAML that needs to change for this ticket (changes to RAML for this should go through a design review with Josh or Chongsun while work is happening on this ticket).

  • When I fill in a line item in this requisition (by hitting the PUT /requisitions/{id} API), I can save this field D. Saving this field D saves zero, one or multiple stock adjustments for each line item (note how the UI will expose this in the screenshots). Each stock adjustment will have a reason, which must be one of the reasons configured for the program of this requisition. Each stock adjustment will also have an explanation string and a quantity. The total quantity of the adjustment will also be saved, because that will be used by other fields in the requisition line item to calculate quantities.

  • Verify that multiple adjustments can be added for the product and they all get added together (each one gets a reason and increments or decrements quantity based on its own reason)

  • If batch management (OLMIS-604) is "on", adjustments require a batch # is specified as well (removed for now because batch management is not in beta; this will be a later enhancement)

  • Users can add or remove adjustments, meaning the API will allow adjustments to be added or removed as the line items are changed and as the requisition is saved (PUT /requisitions/{id} API hit on each save)

  • data validations should match 2.0 functionality

Please review the Catalog of Requisition APIs.

Status

Assignee

Paweł Gesek

Reporter

Mary Jo Kochendorfer

Story Points

5

Epic Link

Sprint

None

Fix versions

Affects versions

Priority

Minor
Configure