[item price] item price made as an individual master and removed from price list

This commit is contained in:
Akhilesh Darjee
2013-10-18 14:24:21 +05:30
parent 04638a5f77
commit fcd70d04f3
22 changed files with 312 additions and 364 deletions

View File

@@ -40,7 +40,9 @@ def get_item_details(args):
args = webnotes._dict(args)
if args.barcode:
args.item_code = _get_item_code(args.barcode)
args.item_code = _get_item_code(barcode=args.barcode)
elif not args.item_code and args.serial_no:
args.item_code = _get_item_code(serial_no=args.serial_no)
item_bean = webnotes.bean("Item", args.item_code)
@@ -88,15 +90,17 @@ def _get_serial_nos_by_fifo(args, item_bean):
"qty": cint(args.qty)
}))
def _get_item_code(barcode):
item_code = webnotes.conn.sql_list("""select name from `tabItem` where barcode=%s""", barcode)
def _get_item_code(barcode=None, serial_no=None):
if barcode:
input_type = "Barcode"
item_code = webnotes.conn.sql_list("""select name from `tabItem` where barcode=%s""", barcode)
elif serial_no:
input_type = "Serial No"
item_code = webnotes.conn.sql_list("""select item_code from `tabSerial No`
where name=%s""", serial_no)
if not item_code:
msgprint(_("No Item found with Barcode") + ": %s" % barcode, raise_exception=True)
elif len(item_code) > 1:
msgprint(_("Items") + " %s " % comma_and(item_code) +
_("have the same Barcode") + " %s" % barcode, raise_exception=True)
msgprint(_("No Item found with ") + input_type + ": %s" % (barcode or serial_no), raise_exception=True)
return item_code[0]
@@ -142,9 +146,8 @@ def _get_basic_details(args, item_bean, warehouse_fieldname):
return out
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.parent = pl.name and ip.parent=%s and
ip.item_code=%s and pl.buying_or_selling='Selling'""",
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:

View File

@@ -27,9 +27,8 @@ def get_product_info(item_code):
else:
in_stock = -1
price = price_list and webnotes.conn.sql("""select ip.ref_rate, pl.currency from
`tabItem Price` ip, `tabPrice List` pl where ip.parent = pl.name and
ip.item_code=%s and ip.parent=%s""",
price = price_list and webnotes.conn.sql("""select ref_rate, currency from
`tabItem Price` where item_code=%s and price_list=%s""",
(item_code, price_list), as_dict=1) or []
price = price and price[0] or None