stock reco and utility function of stocks

This commit is contained in:
Nabin Hait
2013-01-08 18:29:24 +05:30
parent 418d580a8b
commit 902e8609e5
10 changed files with 514 additions and 333 deletions

View File

@@ -1,5 +1,6 @@
from __future__ import unicode_literals
import webnotes
from stock.stock_ledger import update_entries_after
def execute():
# add index
@@ -80,8 +81,13 @@ def cleanup_wrong_sle():
for d in sle:
webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3])
create_comment(d[3])
repost_bin(d[0], d[1])
update_entries_after({
item_code: d[0],
warehouse: d[1],
posting_date: "2012-07-01",
posting_time: "12:05"
})
def create_comment(dn):
from webnotes.model.doc import Document
cmt = Document('Comment')
@@ -91,11 +97,4 @@ def create_comment(dn):
cmt.comment_doctype = 'Stock Ledger Entry'
cmt.comment_docname = dn
cmt.save(1)
def repost_bin(item, wh):
from webnotes.model.code import get_obj
bin = webnotes.conn.sql("select name from `tabBin` \
where item_code = %s and warehouse = %s", (item, wh))
get_obj('Bin', bin[0][0]).update_entries_after(posting_date = '2012-07-01', posting_time = '12:05')