Rushabh Mehta | ad45e31 | 2013-11-20 12:59:58 +0530 | [diff] [blame] | 1 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors |
Rushabh Mehta | e67d1fb | 2013-08-05 14:59:54 +0530 | [diff] [blame] | 2 | # License: GNU General Public License v3. See license.txt |
Nabin Hait | e4e88c9 | 2012-09-24 15:40:56 +0530 | [diff] [blame] | 3 | |
| 4 | from __future__ import unicode_literals |
| 5 | def execute(): |
| 6 | import webnotes |
Nabin Hait | 902e860 | 2013-01-08 18:29:24 +0530 | [diff] [blame] | 7 | from stock.stock_ledger import update_entries_after |
| 8 | res = webnotes.conn.sql("select distinct item_code, warehouse from `tabStock Ledger Entry`") |
Nabin Hait | e4e88c9 | 2012-09-24 15:40:56 +0530 | [diff] [blame] | 9 | i=0 |
Nabin Hait | 902e860 | 2013-01-08 18:29:24 +0530 | [diff] [blame] | 10 | for d in res: |
Nabin Hait | e4e88c9 | 2012-09-24 15:40:56 +0530 | [diff] [blame] | 11 | try: |
Nabin Hait | f78d16c | 2013-06-21 15:13:49 +0530 | [diff] [blame] | 12 | update_entries_after({ "item_code": d[0], "warehouse": d[1]}) |
Nabin Hait | e4e88c9 | 2012-09-24 15:40:56 +0530 | [diff] [blame] | 13 | except: |
| 14 | pass |
| 15 | i += 1 |
| 16 | if i%100 == 0: |
| 17 | webnotes.conn.sql("commit") |
| 18 | webnotes.conn.sql("start transaction") |