If an invoice contains line items for two patients and the patient on one is subsequently changed, their history is not updated to reflect this.
1. create an invoice
2. add an invoice item for patient A, medication X
3. add an invoice item for patient B, medication Y
4. save the invoice, and verify that:
patient A has medication X in their history
patient B has medication Y in their history
5. edit the invoice
6. change the patient for medication Y from B to A
7. save the invoice. Patient A should now have both medications and patient B should have none, but in fact the history hasn't been updated.
The workaround is to delete the invoice item and then recreate it.