From fdeb55ba69def1564108b659aaef95c7ea243718 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 10 May 2012 12:18:11 +0530 Subject: [PATCH] stock reco patch --- erpnext/patches/may_2012/stock_reco_patch.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 erpnext/patches/may_2012/stock_reco_patch.py diff --git a/erpnext/patches/may_2012/stock_reco_patch.py b/erpnext/patches/may_2012/stock_reco_patch.py new file mode 100644 index 0000000000..7eb050fd5d --- /dev/null +++ b/erpnext/patches/may_2012/stock_reco_patch.py @@ -0,0 +1,17 @@ +def execute(): + import webnotes + from webnotes.modules import reload_doc + reload_doc('stock', 'doctype', 'stock_reconciliation') + + sr = webnotes.conn.sql("select name, file_list from `tabStock Reconciliation` where docstatus = 1") + for d in sr: + if d[1]: + filename = d[1].split(',')[1] + + from webnotes.utils import file_manager + fn, content = file_manager.get_file(filename) + + if not isinstance(content, basestring) and hasattr(content, 'tostring'): + content = content.tostring() + + webnotes.conn.sql("update `tabStock Reconciliation` set diff_info = %s where name = %s and ifnull(diff_info, '') = ''", (content, d[0]))