From 63fd4f4e8285f72ce2835e26c7e7d303bf53a79c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 9 Nov 2012 13:13:38 +0530 Subject: [PATCH] fixed stock reconciliation cancellation --- .../doctype/stock_reconciliation/stock_reconciliation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.py b/stock/doctype/stock_reconciliation/stock_reconciliation.py index 28a1271cdb..7ae51700d6 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -223,9 +223,13 @@ class DocType: """, self.doc.name) def update_entries_after(self): - self.get_reconciliation_data(submit = 0) + # get distinct combination of item_code and warehouse to update bin + item_warehouse = webnotes.conn.sql("""select distinct item_code, warehouse + from `tabStock Ledger Entry` where voucher_no = %s and is_cancelled = 'Yes' + and voucher_type = 'Stock Reconciliation'""", self.doc.name) + from webnotes.model.code import get_obj - for d in self.data: + for d in item_warehouse: bin = webnotes.conn.sql("select name from `tabBin` where item_code = %s and \ warehouse = %s", (d[0], d[1])) get_obj('Bin', bin[0][0]).update_entries_after(self.doc.reconciliation_date, \