Pack rounding on Requisitions is not calculating based on RoundToZero


The Requisition form seems to be calculating Packs to Ship without using the RoundToZero setting from the orderable.

See Orderable C1 definition in demo data:
(Net Content aka Pack Size is 16 and RoundToZero=false)

Requesting 104 Quantity still only calculated 6 packs (6 packs of 16 will ship 96 dispensing units):

Requesting 105 Quantity calculates 7 packs (7 packs of 16 will ship 112 dispensing units):

The correct behavior when RoundToZero is false should be to round up to ship 7 packs any time you request more than 96 (and up to 112).

Steps to Reproduce

  • See similar steps in the related ticket

  • You don't have to submit/authorize/approve/convert. You just have to start entering quantities for C1.

  • ERROR: Packs to Ship (Packs CMST) column is calculating wrong.

Desired Behavior/Current Documentation from Configuration Guide:

The can round to zero attribute determines whether OpenLMIS will round the number of packs to ship down to zero when the reorder quantity is less than one full pack and is less than or equal to the rounding threshold for this product. For our antibiotic example, if the reorder quantity was 6 strips (equal to the rounding threshold), then OpenLMIS would round the order quantity down to zero packs if can round to zeroes true. Conversely, it would round the order quantity up to one if can round to zeroes false. In other words, when can round to zeroes set to false, OpenLMIS will always ship at least one full pack when the reorder quantity is one or more dispensing units. If the reorder quantity is zero dispensing units, then OpenLMIS will ship zero packs, regardless of the value of can round to zero.

Acceptance Criteria

  • Fix 'roundToZero' calculations so it matches the desired behavior

  • Add automated tests for RoundToZero false and true calculation

    • Does this calculation live in JavaScript UI code, in Java API code, or both?

  • Update documentation or confirm the behavior now matches the documentation in the Configuration Guide (look for the sections that start "The pack rounding threshold attribute..." and "The can round to zero attribute...")






Brandon Bowersox-Johnson