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,10 +1,15 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.code import get_obj
bins = webnotes.conn.sql("select distinct t2.name from `tabStock Ledger Entry` t1, tabBin t2 where t1.posting_time > '00:00:00' and t1.posting_time < '00:01:00' and t1.item_code = t2.item_code and t1.warehouse = t2.warehouse")
res = webnotes.conn.sql("""select distinct item_code, warehouse from `tabStock Ledger Entry`
where posting_time > '00:00:00' and posting_time < '00:01:00'""", as_dict=1)
webnotes.conn.sql("update `tabStock Ledger Entry` set posting_time = '00:00:00' where posting_time > '00:00:00' and posting_time < '00:01:00'")
for d in bins:
get_obj('Bin', d[0]).update_entries_after(posting_date = '2000-01-01', posting_time = '12:01')
from stock.stock_ledger import update_entries_after
for d in res:
update_entries_after({
item_code: d.item_code,
warehouse: d.warehouse,
posting_date: '2000-01-01',
posting_time: '12:01'
})