Merge pull request #16001 from jsukrut/staging-fixes

[FIX][#15018][PATIENT Relation should be unique]
This commit is contained in:
Nabin Hait 2018-11-26 20:01:19 +05:30 committed by GitHub
commit 21983b8432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,3 +120,16 @@ var btn_invoice_registration = function (frm) {
}
});
};
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]] };
};
}
});