<commit_before>// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt

// Refresh
// --------

frappe.ui.form.on('Custom Field', {
	setup: function(frm) {
		frm.set_query('dt', function(doc) {
			filters = [
				['DocType', 'issingle', '=', 0],
			];
			if(user!=="Administrator") {
				filters.push(['DocType', 'module', '!=', 'Core'])
			}
			return filters
		});
	},
	refresh: function(frm) {
		frm.toggle_enable('dt', frm.doc.__islocal);
		frm.trigger('dt');
		frm.toggle_reqd('label', !frm.doc.fieldname);
	},
	dt: function(frm) {
		if(!frm.doc.dt) {
			set_field_options('insert_after', '');
			return;
		}
		var insert_after = frm.doc.insert_after || null;
		return frappe.call({
			method: 'frappe.custom.doctype.custom_field.custom_field.get_fields_label',
			args: { doctype: frm.doc.dt, fieldname: frm.doc.fieldname },
			callback: function(r, rt) {<commit_msg>[minor] fixed the set_query for the doctype field in Custom Field (#3275)<commit_after>// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt

// Refresh
// --------

frappe.ui.form.on('Custom Field', {
	setup: function(frm) {
		frm.set_query('dt', function(doc) {
			filters = [
				['DocType', 'issingle', '=', 0],
			];
			if(user!=="Administrator") {
				filters.push(['DocType', 'module', '!=', 'Core'])
			}
			return {
				"filters": filters
			}
		});
	},
	refresh: function(frm) {
		frm.toggle_enable('dt', frm.doc.__islocal);
		frm.trigger('dt');
		frm.toggle_reqd('label', !frm.doc.fieldname);
	},
	dt: function(frm) {
		if(!frm.doc.dt) {
			set_field_options('insert_after', '');
			return;
		}
		var insert_after = frm.doc.insert_after || null;
		return frappe.call({
			method: 'frappe.custom.doctype.custom_field.custom_field.get_fields_label',
			args: { doctype: frm.doc.dt, fieldname: frm.doc.fieldname },
			callback: function(r, rt) {
{'fraction_non_alphanumeric': 0.19270833333333334, 'fraction_numerical': 0.007291666666666667, 'mean_word_length': 3.6853658536585368, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5101435', 'n_tokens_mistral': 821, 'n_tokens_neox': 724, 'n_words': 130}