def get_price_list():
 rate = {}
 price_list = frappe.db.sql(u'select ip.item_code, ip.buying, ip.selling,\n DCTB  DCTB concat(ifnull(cu.symbol,ip.currency), " ", round(ip.price_list_rate,2), " - ", ip.price_list) as price\n DCTB  DCTB from `tabItem Price` ip, `tabPrice List` pl, `tabCurrency` cu\n DCTB  DCTB where ip.price_list=pl.name and pl.currency=cu.name and pl.enabled=1', as_dict=1)
 for j in price_list:
  if j.price:
   rate.setdefault(j.item_code, {}).setdefault((u'Buying' if j.buying else u'Selling'), []).append(j.price)
 item_rate_map = {}
 for item in rate:
  for buying_or_selling in rate[item]:
   item_rate_map.setdefault(item, {}).setdefault(buying_or_selling, u', '.join(rate[item].get(buying_or_selling, [])))
 return item_rate_map

def get_price_list ( ) : rate = { } price_list = frappe . db . sql ( u'select ip.item_code, ip.buying, ip.selling,\n DCTB  DCTB concat(ifnull(cu.symbol,ip.currency), " ", round(ip.price_list_rate,2), " - ", ip.price_list) as price\n DCTB  DCTB from `tabItem Price` ip, `tabPrice List` pl, `tabCurrency` cu\n DCTB  DCTB where ip.price_list=pl.name and pl.currency=cu.name and pl.enabled=1' , as_dict = 1 ) for j in price_list : if j . price : rate . setdefault ( j . item_code , { } ) . setdefault ( ( u'Buying' if j . buying else u'Selling' ) , [ ] ) . append ( j . price ) item_rate_map = { } for item in rate : for buying_or_selling in rate [ item ] : item_rate_map . setdefault ( item , { } ) . setdefault ( buying_or_selling , u', ' . join ( rate [ item ] . get ( buying_or_selling , [ ] ) ) ) return item_rate_map
get selling & buying price list of every item .