<commit_before>import frappe, json

def execute():
	# stock reco now amendable
	frappe.db.sql("""update tabDocPerm set `amend` = 1 where parent='Stock Reconciliation' and submit = 1""")


	if frappe.db.has_column("Stock Reconciliation", "reconciliation_json"):
		for sr in frappe.db.get_all("Stock Reconciliation", ["name"],
			{"reconciliation_json": ["!=", ""]}):
			start = False
			sr = frappe.get_doc("Stock Reconciliation", sr.name)
			for item in json.loads(sr.reconciliation_json):
				if start:
					sr.append("items", {
						"item_code": item[0],
						"warehouse": item[1],
						"valuation_rate": item[3],
						"qty": item[4]
					})

				elif item[0]=="Item Code":
					start = True


			for item in sr.items:
				item.db_update()
<commit_msg>[test] newsletter list<commit_after>import frappe, json

def execute():
	# stock reco now amendable
	frappe.db.sql("""update tabDocPerm set `amend` = 1 where parent='Stock Reconciliation' and submit = 1""")


	if frappe.db.has_column("Stock Reconciliation", "reconciliation_json"):
		for sr in frappe.db.get_all("Stock Reconciliation", ["name"],
			{"reconciliation_json": ["!=", ""]}):
			start = False
			sr = frappe.get_doc("Stock Reconciliation", sr.name)
			for item in json.loads(sr.reconciliation_json):
				if start:
					sr.append("items", {
						"item_code": item[0],
						"warehouse": item[1],
						"qty": item[3] if len(item) > 2 else None,
						"valuation_rate": item[4] if len(item) > 3 else None
					})

				elif item[0]=="Item Code":
					start = True


			for item in sr.items:
				item.db_update()

{'fraction_non_alphanumeric': 0.15832805573147563, 'fraction_numerical': 0.01013299556681444, 'mean_word_length': 3.6607669616519174, 'pattern_counts': {'":': 12, '<': 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': '2886108', 'n_tokens_mistral': 683, 'n_tokens_neox': 560, 'n_words': 136}