blob: 1fec9499ab58ab05522acd886577eaaf22a9baf8 [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 Hait902e8602013-01-08 18:29:24 +053025 update_entries_after({
26 item_code: d[0],
27 warehouse: d[1],
28 posting_date: "2000-01-01",
29 posting_time: "12:00"
30 })
Nabin Haite4e88c92012-09-24 15:40:56 +053031 except:
32 pass
33 i += 1
34 if i%100 == 0:
35 webnotes.conn.sql("commit")
36 webnotes.conn.sql("start transaction")