<commit_before>import frappe
from erpnext.manufacturing.doctype.production_order.production_order \
	import make_timesheet, add_timesheet_detail

def execute():
	frappe.reload_doc('projects', 'doctype', 'timesheet')
	if not frappe.db.table_exists("Time Log"):
		return

	for data in frappe.db.sql("select * from `tabTime Log` where where docstatus < 2", as_dict=1):
		if data.task:
			company = frappe.db.get_value("Task", data.task, "company")
		elif data.production_order:
			company = frappe.db.get_value("Prodction Order", data.production_order, "company")
		else:
			company = frappe.db.get_single_value('Global Defaults', 'default_company')
		
		time_sheet = make_timesheet(data.production_order)
		args = get_timelog_data(data)
		add_timesheet_detail(time_sheet, args)
		time_sheet.docstatus = data.docstatus
		time_sheet.employee = data.employee<commit_msg>Update convert_timelog_to_timesheet.py<commit_after>import frappe
from erpnext.manufacturing.doctype.production_order.production_order \
	import make_timesheet, add_timesheet_detail

def execute():
	frappe.reload_doc('projects', 'doctype', 'timesheet')
	if not frappe.db.table_exists("Time Log"):
		return

	for data in frappe.db.sql("select * from `tabTime Log` where docstatus < 2", as_dict=1):
		if data.task:
			company = frappe.db.get_value("Task", data.task, "company")
		elif data.production_order:
			company = frappe.db.get_value("Prodction Order", data.production_order, "company")
		else:
			company = frappe.db.get_single_value('Global Defaults', 'default_company')
		
		time_sheet = make_timesheet(data.production_order)
		args = get_timelog_data(data)
		add_timesheet_detail(time_sheet, args)
		time_sheet.docstatus = data.docstatus
		time_sheet.employee = data.employee
{'fraction_non_alphanumeric': 0.1126357918810749, 'fraction_numerical': 0.002287021154945683, 'mean_word_length': 5.8359375, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5390674', 'n_tokens_mistral': 630, 'n_tokens_neox': 595, 'n_words': 113}