@frappe.whitelist()
def apply_price_list(args, as_doc=False):
 args = process_args(args)
 parent = get_price_list_currency_and_exchange_rate(args)
 children = []
 if (u'items' in args):
  item_list = args.get(u'items')
  args.update(parent)
  for item in item_list:
   args_copy = frappe._dict(args.copy())
   args_copy.update(item)
   item_details = apply_price_list_on_item(args_copy)
   children.append(item_details)
 if as_doc:
  args.price_list_currency = parent.price_list_currency
  args.plc_conversion_rate = parent.plc_conversion_rate
  if args.get(u'items'):
   for (i, item) in enumerate(args.get(u'items')):
    for fieldname in children[i]:
     if ((fieldname in item) and (fieldname not in (u'name', u'doctype'))):
      item[fieldname] = children[i][fieldname]
  return args
 else:
  return {u'parent': parent, u'children': children}

@ frappe . whitelist ( ) def apply_price_list ( args , as_doc = False ) : args = process_args ( args ) parent = get_price_list_currency_and_exchange_rate ( args ) children = [ ] if ( u'items' in args ) : item_list = args . get ( u'items' ) args . update ( parent ) for item in item_list : args_copy = frappe . _dict ( args . copy ( ) ) args_copy . update ( item ) item_details = apply_price_list_on_item ( args_copy ) children . append ( item_details ) if as_doc : args . price_list_currency = parent . price_list_currency args . plc_conversion_rate = parent . plc_conversion_rate if args . get ( u'items' ) : for ( i , item ) in enumerate ( args . get ( u'items' ) ) : for fieldname in children [ i ] : if ( ( fieldname in item ) and ( fieldname not in ( u'name' , u'doctype' ) ) ) : item [ fieldname ] = children [ i ] [ fieldname ] return args else : return { u'parent' : parent , u'children' : children }
apply pricelist on a document-like dict object and return as {parent: dict .