Skip to content

Conversation

@UjjawalPrabhat
Copy link
Contributor

@UjjawalPrabhat UjjawalPrabhat commented Jan 15, 2026

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work is based on designs, which are linked or shown either in the Jira ticket or the description below. (See also: Styleguide)
  • My work includes tests or is validated by existing tests.

Summary

This PR standardizes medication continuation behavior in OpenMRS O3 by unifying Renew as the single action for continuing medications across both Active and Past Medications.

Previously, Renew termed as 'Reorder' was only available for past medications while active medications required manual re-entry, and the overlapping Reorder action caused inconsistent terminology. This change improves clinician workflow and aligns with agreed community behavior.

Screen Recording

Screen.Recording.2026-01-15.190623.mp4

Related Issue

O3-5169

Other

Talk discussion

Related PR

@UjjawalPrabhat UjjawalPrabhat changed the title (feat) O3-5169: extend Renew action to Active Medications and standardize Reorder as Renew (feat) O3-5169: Extend Renew action to Active Medications and standardize Reorder as Renew Jan 15, 2026
@UjjawalPrabhat UjjawalPrabhat force-pushed the feat/O3-5169-medication-renew-button branch from 40105b6 to b69e058 Compare January 15, 2026 14:13
@UjjawalPrabhat
Copy link
Contributor Author

@denniskigen @VeronicaMuthee Could you please review this PR?

@VeronicaMuthee
Copy link
Contributor

@UjjawalPrabhat, this looks good to me per the video you have shared. Please add Ian and Dennis as your reviewers for the technical details

@UjjawalPrabhat
Copy link
Contributor Author

@denniskigen @VeronicaMuthee Could you please review this PR?

@ibacher

@VeronicaMuthee
Copy link
Contributor

@UjjawalPrabhat, you haven't added reviewers as yet. Are you able to do that?

@UjjawalPrabhat
Copy link
Contributor Author

UjjawalPrabhat commented Jan 19, 2026

@UjjawalPrabhat, you haven't added reviewers as yet. Are you able to do that?

@VeronicaMuthee, I don't have the required permission to add reviewers. Perhaps you could help me with that? 😅

Copy link
Member

@denniskigen denniskigen Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add the uuid: order.uuid to line 250 in buildMedicationOrder to fix duplicate order detection in the order basket.

After refactoring to buildMedicationOrder, renew/discontinue basket items no longer get a uuid. The UI still uses uuid for duplicate prevention:

const alreadyInBasket = items.some((x) => x.uuid === medication.uuid);

in the OrderBasketItemActions function.

Previously both handleDiscontinueClick and handleReorderClick set uuid: medication.uuid inline (see pre‑refactor code), so the check worked. Now buildMedicationOrder returns no uuid (see this), so alreadyInBasket always returns false and users can add duplicate renew/discontinue items.

Note that this is a client-side field only; it's not sent to the backend (see prepMedicationOrderPostData). The backend uses previousOrder for order linkage, and it will reject overlapping duplicates anyway via AmbiguousOrderException("Order.cannot.have.more.than.one") in OrderServiceImpl, so preventing duplicates client‑side aligns with backend constraints.

@denniskigen
Copy link
Member

Can we also change this line to read "renew" instead of "reorder"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants