[merge] [minor] merged with master for serial_no updatess

This commit is contained in:
Nabin Hait
2013-08-20 11:28:38 +05:30
40 changed files with 810 additions and 761 deletions

View File

@@ -105,7 +105,6 @@ class DocType(TransactionBase):
msgprint("Please fetch items from Delivery Note selected", raise_exception=1)
def on_update(self):
get_obj("Stock Ledger").scrub_serial_nos(self, 'installed_item_details')
webnotes.conn.set(self.doc, 'status', 'Draft')
def on_submit(self):

View File

@@ -71,9 +71,22 @@ def get_item_details(args):
pos_settings = get_pos_settings(args.company)
if pos_settings:
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 timestamp(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)