<commit_before>import webnotes
from webnotes.utils import cint

def execute():
	for price_list in webnotes.conn.sql_list("""select name from `tabPrice List`"""):
		buying, selling = False, False
		for b, s in webnotes.conn.sql("""select distinct buying, selling 
			from `tabItem Price` where price_list_name=%s""", price_list):
				buying = buying or cint(b)
				selling = selling or cint(s)
		
		webnotes.conn.set_value("Price List", price_list, "buying_or_selling", ("Selling" if selling else "Buying"))
		webnotes.conn.sql("""update `tabItem Price` set buying_or_selling=%s where price_list_name=%s""", 
			(("Selling" if selling else "Buying"), price_list))<commit_msg>[price list] [fix] fix in buying selling price list patch<commit_after>import webnotes
from webnotes.utils import cint

def execute():
	webnotes.reload_doc("setup", "doctype", "price_list")
	webnotes.reload_doc("stock", "doctype", "item_price")
	
	for price_list in webnotes.conn.sql_list("""select name from `tabPrice List`"""):
		buying, selling = False, False
		for b, s in webnotes.conn.sql("""select distinct buying, selling 
			from `tabItem Price` where price_list_name=%s""", price_list):
				buying = buying or cint(b)
				selling = selling or cint(s)
		
		buying_or_selling = "Selling" if selling else "Buying"
		webnotes.conn.set_value("Price List", price_list, "buying_or_selling", buying_or_selling)
		webnotes.conn.sql("""update `tabItem Price` set buying_or_selling=%s 
			where price_list_name=%s""", (buying_or_selling, price_list))
{'fraction_non_alphanumeric': 0.13066316480630336, 'fraction_numerical': 0.0, 'mean_word_length': 5.597402597402597, 'pattern_counts': {'":': 0, '<': 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': '1688455', 'n_tokens_mistral': 540, 'n_tokens_neox': 499, 'n_words': 140}