[FIX][#15018][PATIENT Relation should be unique]
diff --git a/erpnext/healthcare/doctype/patient/patient.js b/erpnext/healthcare/doctype/patient/patient.js
index d0ab94c..de5bce0 100644
--- a/erpnext/healthcare/doctype/patient/patient.js
+++ b/erpnext/healthcare/doctype/patient/patient.js
@@ -120,3 +120,16 @@
}
});
};
+
+frappe.ui.form.on('Patient Relation', {
+ patient_relation_add: function(frm){
+ frm.fields_dict['patient_relation'].grid.get_field('patient').get_query = function(frm){
+ var patient_list = [];
+ if(!frm.doc.__islocal) patient_list.push(frm.doc.name);
+ $.each(frm.doc.patient_relation, function(idx, val){
+ if (val.patient) patient_list.push(val.patient);
+ });
+ return { filters: [['Patient', 'name', 'not in', patient_list]] };
+ };
+ }
+});
\ No newline at end of file