As we want to add orderable’s versioning to OpenLMIS, I’m currently working on the design of using it in order line item, shipment line item and proof of delivery line item. I went through our code and it looks like we don’t need many changes to achieve what we want.
Definitely, we’ll need to create a new class with orderable ID and version to group orderable info and avoid code duplication. Then we’ll be able to replace those properties with the newly created class object in the domain classes of mentioned line items so order, shipment, and proof of delivery line items will have a reference to the specific orderable version. The values of orderableId and orderedQuantity properties from OrderLineItem are set based on RequisitionLineItem fields and values in ShipmentLineItem are set based on OrderLineItem. Also, RequisitionLineItem should already have a reference to versioned orderable (orderable ID + version). This will be designed in OLMIS-3931.
It looks like none of the properties in line items are snapshotted besides one - useVvm parameter from ProofOfDeliveryLineItem. It is injected from OrderableDto’s extraData parameter in ShipmentService. It should work properly without any changes - the OrderableDto will have the proper version of orderable because it will be retrieved from referencedata service using the version from the PoD line item. Despite that, I’d suggest dropping useVvm parameter since we want to get rid of snapshotting in requisition and PoD will have reference to versioned orderable.
Furthermore, we’ll need to update some of our reports. Printing Proof of Delivery uses OrderableDto so it’s safe but printing orders and Pick pack list use SQL to generate a report. I think that the only change we need to apply is updating JOIN to check whether orderable version matches to the orderable version in PoD.
Any thoughts? Do you see any potential issues that I didn’t notice?