Nabin Hait | e4e88c9 | 2012-09-24 15:40:56 +0530 | [diff] [blame] | 1 | # 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 | |
| 17 | from __future__ import unicode_literals |
| 18 | def execute(): |
| 19 | import webnotes |
Nabin Hait | 902e860 | 2013-01-08 18:29:24 +0530 | [diff] [blame] | 20 | from stock.stock_ledger import update_entries_after |
| 21 | 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] | 22 | i=0 |
Nabin Hait | 902e860 | 2013-01-08 18:29:24 +0530 | [diff] [blame] | 23 | for d in res: |
Nabin Hait | e4e88c9 | 2012-09-24 15:40:56 +0530 | [diff] [blame] | 24 | try: |
Nabin Hait | 26d4655 | 2013-01-09 15:23:05 +0530 | [diff] [blame] | 25 | update_entries_after({ "item_code": d[0], "warehouse": d[1] }) |
Nabin Hait | e4e88c9 | 2012-09-24 15:40:56 +0530 | [diff] [blame] | 26 | except: |
| 27 | pass |
| 28 | i += 1 |
| 29 | if i%100 == 0: |
| 30 | webnotes.conn.sql("commit") |
| 31 | webnotes.conn.sql("start transaction") |