def _get_price_list_rate(args, item_bean, meta): from utilities.transaction_base import validate_currency item = item_bean.doc out = webnotes._dict() # try fetching from price list if args.buying_price_list and args.price_list_currency: price_list_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` where price_list=%s and item_code=%s and buying_or_selling='Buying'""", (args.buying_price_list, args.item_code), as_dict=1) if price_list_rate: validate_currency(args, item_bean.doc, meta) out.import_ref_rate = flt(price_list_rate[0].ref_rate) * \ flt(args.plc_conversion_rate) / flt(args.conversion_rate) # if not found, fetch from last purchase transaction if not out.import_ref_rate: last_purchase = get_last_purchase_details(item.name, args.docname, args.conversion_rate) if last_purchase: out.update(last_purchase) if out.import_ref_rate or out.import_rate: validate_currency(args, item, meta) return out
def _get_price_list_rate(args, item_bean, meta): from utilities.transaction_base import validate_currency item = item_bean.doc out = webnotes._dict() # try fetching from price list if args.price_list_name and args.price_list_currency: price_list_rate = item_bean.doclist.get({ "parentfield": "ref_rate_details", "price_list_name": args.price_list_name, "ref_currency": args.price_list_currency, "buying_or_selling": "Buying" }) if price_list_rate: out.import_ref_rate = \ flt(price_list_rate[0].ref_rate * args.plc_conversion_rate / args.conversion_rate) # if not found, fetch from last purchase transaction if not out.import_ref_rate: last_purchase = get_last_purchase_details(item.name, args.docname, args.conversion_rate) if last_purchase: out.update(last_purchase) if out.import_ref_rate or out.import_rate: validate_currency(args, item, meta) return out
def _get_price_list_rate(args, item_bean, meta): from utilities.transaction_base import validate_currency item = item_bean.doc out = webnotes._dict() # try fetching from price list if args.price_list_name and args.price_list_currency: price_list_rate = item_bean.doclist.get({ "parentfield": "ref_rate_details", "price_list_name": args.price_list_name, "ref_currency": args.price_list_currency, "buying_or_selling": "Buying"}) if price_list_rate: out.import_ref_rate = \ flt(price_list_rate[0].ref_rate * args.plc_conversion_rate / args.conversion_rate) # if not found, fetch from last purchase transaction if not out.import_ref_rate: last_purchase = get_last_purchase_details(item.name, args.docname, args.conversion_rate) if last_purchase: out.update(last_purchase) if out.import_ref_rate or out.import_rate: validate_currency(args, item, meta) return out
def _get_price_list_rate(args, item_bean, meta): ref_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` where price_list=%s and item_code=%s and selling=1""", (args.selling_price_list, args.item_code), as_dict=1) if not ref_rate: return {} # found price list rate - now we can validate from utilities.transaction_base import validate_currency validate_currency(args, item_bean.doc, meta) return {"ref_rate": flt(ref_rate[0].ref_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate)}
def _get_price_list_rate(args, item_bean, meta): ref_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` where price_list=%s and item_code=%s and buying_or_selling='Selling'""", (args.selling_price_list, args.item_code), as_dict=1) if not ref_rate: return {} # found price list rate - now we can validate from utilities.transaction_base import validate_currency validate_currency(args, item_bean.doc, meta) return {"ref_rate": flt(ref_rate[0].ref_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate)}
def _get_price_list_rate(args, item_bean, meta): base_ref_rate = item_bean.doclist.get({ "parentfield": "ref_rate_details", "price_list_name": args.price_list_name, "ref_currency": args.price_list_currency, "buying_or_selling": "Selling"}) if not base_ref_rate: return {} # found price list rate - now we can validate from utilities.transaction_base import validate_currency validate_currency(args, item_bean.doc, meta) return {"ref_rate": flt(base_ref_rate[0].ref_rate * args.plc_conversion_rate / args.conversion_rate)}
def _get_price_list_rate(args, item_bean, meta): base_ref_rate = item_bean.doclist.get({ "parentfield": "ref_rate_details", "price_list": args.selling_price_list, "ref_currency": args.price_list_currency, "buying_or_selling": "Selling" }) if not base_ref_rate: return {} # found price list rate - now we can validate from utilities.transaction_base import validate_currency validate_currency(args, item_bean.doc, meta) return { "ref_rate": flt(base_ref_rate[0].ref_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate) }
def _get_price_list_rate(args, item_bean, meta): ref_rate = webnotes.conn.sql("""select ip.ref_rate from `tabItem Price` ip, `tabPrice List` pl where ip.price_list=pl.name and ip.price_list=%s and ip.item_code=%s and ip.selling=1 and pl.enabled=1""", (args.selling_price_list, args.item_code), as_dict=1) if not ref_rate: return {} # found price list rate - now we can validate from utilities.transaction_base import validate_currency validate_currency(args, item_bean.doc, meta) return { "ref_rate": flt(ref_rate[0].ref_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate) }