blob: deb218637e91b0b3ee3935621756a99192c6e3a4 [file] [log] [blame]
Nabin Haite4e88c92012-09-24 15:40:56 +05301# ERPNext - web based ERP (http://erpnext.com)
2# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from __future__ import unicode_literals
18def execute():
19 import webnotes
Nabin Hait902e8602013-01-08 18:29:24 +053020 from stock.stock_ledger import update_entries_after
21 res = webnotes.conn.sql("select distinct item_code, warehouse from `tabStock Ledger Entry`")
Nabin Haite4e88c92012-09-24 15:40:56 +053022 i=0
Nabin Hait902e8602013-01-08 18:29:24 +053023 for d in res:
Nabin Haite4e88c92012-09-24 15:40:56 +053024 try:
Nabin Haitf78d16c2013-06-21 15:13:49 +053025 update_entries_after({ "item_code": d[0], "warehouse": d[1]})
Nabin Haite4e88c92012-09-24 15:40:56 +053026 except:
27 pass
28 i += 1
29 if i%100 == 0:
30 webnotes.conn.sql("commit")
31 webnotes.conn.sql("start transaction")