related pull request:
notes from src/pharmacy/app/controller/prescription.js line 1604:
TODO: Should we be updating the URL here? as done in submitIssue
// If we are updating an existing purchase order, set url for that specific P.O.
No, URL should not be updated.
When I decrement batches, I could have a bunch of different inventories that do not belong to the same purchaseOrder. A prescription could be from drugInventory A, from purchaseOrder P1, and drugInventory B, from purchaseOrder P2
I wanted a way to easily decrement a bunch of inventories, and the back end already has a way to group inventories together – a purchaseOrder. Setting the name as 'Prescription' for a purchaseOrder is just for decrementing batches, it doesn't actually save any new purchase order in the back end. All it does is update the quantities of inventories.
However, this solution isn't 100% perfect – what we do eventually want, is some sort of purchase order type to save in the back end. Then we don't need to rely on the name for a purchase order to be a certain string: 'Issue', 'Requisition', 'Prescription', or 'Receipt'
Is part of refactoring but a lower priority, I believe. Would be interested to hear other's thoughts on
1. simple purchase orders that have different functions based on the name string (could be more error prone)
2. a more complex but robust way to differentiate purchase orders, such as a whole new resource in the back end for purchaseOrderType