Serial no fix
This commit is contained in:
parent
53f7ba26f6
commit
f2f17959ab
@ -4,14 +4,16 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
|
||||
def execute():
|
||||
serial_nos = webnotes.conn.sql("""select name from `tabSerial No` where docstatus=0
|
||||
and status in ('Available', 'Sales Returned') and ifnull(warehouse, '') = ''""")
|
||||
for sr in serial_nos:
|
||||
try:
|
||||
sr_bean = webnotes.bean("Serial No", sr[0])
|
||||
sr_bean.make_controller().via_stock_ledger = True
|
||||
sr_bean.save()
|
||||
last_sle = webnotes.bean("Serial No", sr[0]).make_controller().get_last_sle()
|
||||
if last_sle.actual_qty > 0:
|
||||
webnotes.conn.set_value("Serial No", sr[0], "warehouse", last_sle.warehouse)
|
||||
|
||||
webnotes.conn.commit()
|
||||
except:
|
||||
pass
|
@ -87,8 +87,6 @@ class DocType(StockController):
|
||||
self.doc.status = "Sales Returned"
|
||||
else:
|
||||
self.doc.status = "Available"
|
||||
if not self.doc.warehouse:
|
||||
self.doc.warehouse = last_sle.warehouse
|
||||
else:
|
||||
if document_type == "Purchase Return":
|
||||
self.doc.status = "Purchase Returned"
|
||||
|
Loading…
x
Reference in New Issue
Block a user