Merge pull request #20596 from PratikM34/develop

fix: restricted duplicate topics on Course doctype (#20594)
This commit is contained in:
Deepesh Garg 2020-02-23 20:56:43 +05:30 committed by GitHub
commit dee42de0fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,3 +37,16 @@ frappe.ui.form.on("Course", "refresh", function(frm) {
}
});
});
frappe.ui.form.on('Course Topic', {
topics_add: function(frm){
frm.fields_dict['topics'].grid.get_field('topic').get_query = function(doc){
var topics_list = [];
if(!doc.__islocal) topics_list.push(doc.name);
$.each(doc.topics, function(idx, val){
if (val.topic) topics_list.push(val.topic);
});
return { filters: [['Topic', 'name', 'not in', topics_list]] };
};
}
});