<commit_before>// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Project", {
	onload: function (frm) {
		var so = frappe.meta.get_docfield("Project", "sales_order");
		so.get_route_options_for_new_doc = function (field) {
			if (frm.is_new()) return;
			return {
				"customer": frm.doc.customer,
				"project_name": frm.doc.name
			}
		}<commit_msg>fix: Set project in Timesheet (#18371)<commit_after>// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Project", {
	setup(frm) {
		frm.make_methods = {
			'Timesheet': () => {
				let doctype = 'Timesheet';
				frappe.model.with_doctype(doctype, () => {
					let new_doc = frappe.model.get_new_doc(doctype);

					// add a new row and set the project
					let time_log = frappe.model.get_new_doc('Timesheet Detail');
					time_log.project = frm.doc.name;
					new_doc.time_logs = [time_log];

					frappe.ui.form.make_quick_entry(doctype, null, null, new_doc);
				});
			},
		}
	},
	onload: function (frm) {
		var so = frappe.meta.get_docfield("Project", "sales_order");
		so.get_route_options_for_new_doc = function (field) {
			if (frm.is_new()) return;
			return {
				"customer": frm.doc.customer,
				"project_name": frm.doc.name
			}
		}
{'fraction_non_alphanumeric': 0.14398848092152627, 'fraction_numerical': 0.01079913606911447, 'mean_word_length': 3.5874587458745872, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, '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': '5206251', 'n_tokens_mistral': 595, 'n_tokens_neox': 508, 'n_words': 109}