[Serial No] Major updates, code cleanup, "In Store" is now "Available". Serial No can only be created via Stock Entry / Purchase Receipt. Serial No can be auto created using Series if mentioned in Item master

This commit is contained in:
Rushabh Mehta
2013-08-14 18:37:28 +05:30
parent ffe64db8f7
commit 62030e05cc
30 changed files with 686 additions and 656 deletions

View File

@@ -70,9 +70,22 @@ def get_item_details(args):
if cint(args.is_pos):
pos_settings = get_pos_settings(args.company)
out.update(apply_pos_settings(pos_settings, out))
if args.doctype in ("Sales Invoice", "Delivery Note"):
if item_bean.doc.has_serial_no and not args.serial_no:
out.serial_no = _get_serial_nos_by_fifo(args, item_bean)
return out
def _get_serial_nos_by_fifo(args, item_bean):
return "\n".join(webnotes.conn.sql_list("""select name from `tabSerial No`
where item_code=%(item_code)s and warehouse=%(warehouse)s and status='Available'
order by datetime(purchase_date, purchase_time) asc limit %(qty)s""" % {
"item_code": args.item_code,
"warehouse": args.warehouse,
"qty": cint(args.qty)
}))
def _get_item_code(barcode):
item_code = webnotes.conn.sql_list("""select name from `tabItem` where barcode=%s""", barcode)