Skip to content

Fix linked item auto-population in Medication form#1005

Open
md-umair-21 wants to merge 1 commit into
earthians:developfrom
md-umair-21:linked_items
Open

Fix linked item auto-population in Medication form#1005
md-umair-21 wants to merge 1 commit into
earthians:developfrom
md-umair-21:linked_items

Conversation

@md-umair-21

@md-umair-21 md-umair-21 commented May 21, 2026

Copy link
Copy Markdown
Contributor

Issue:
Selecting an existing Item in the linked_items child table of the Medication form did not auto-populate dependent fields like item_group, brand, manufacturer, description.

PR description:
This change fixes the Medication Linked Item child table so selecting an Item correctly pulls related values from the linked Item master.

Changes made:
Added fetch_from for item_group
Added fetch_from for brand
Added fetch_from for manufacturer ( will be fetched if the manufacturer is added in the item manufacturer form and set it as default)
Added fetch_from for description

The child table fields were missing fetch_from mappings, so Frappe had no field-level instructions to copy values from the selected Item. With these mappings in place, the form now auto-fills the expected details when an item is selected.

image

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 57a4bcb7-5ae3-4763-adfb-f6471e2f9f49

📥 Commits

Reviewing files that changed from the base of the PR and between 6711f5e and 77f3568.

📒 Files selected for processing (1)
  • healthcare/healthcare/doctype/medication_linked_item/medication_linked_item.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • healthcare/healthcare/doctype/medication_linked_item/medication_linked_item.json

Walkthrough

This PR updates the Medication Linked Item DocType JSON schema to add fetch_from mappings that automatically populate field values from the selected item. The brand field now fetches from item.brand, manufacturer from item.default_item_manufacturer, item_group from item.item_group, and description from item.description. The DocType's modified timestamp was refreshed.

Possibly related PRs

  • earthians/marley#928: Both PRs modify the Medication Linked Item DocType; #928 makes the item field editable while this PR adds fetch_from mappings that pull values from the selected item.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding fetch_from mappings to enable auto-population of linked item fields in the Medication form.
Description check ✅ Passed The description clearly explains the issue, solution, and specific changes made (adding fetch_from mappings for item_group, brand, manufacturer, and description fields).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant