From d09039ae43d8915ad59f5570511ecb3ec05a2ddb Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 16:29:52 +0530 Subject: [PATCH] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- patches/september_2013/p01_fix_buying_amount_gl_entries.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index 160aa15e54..22017b4c44 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -45,9 +45,9 @@ def recreate_gl_entries(doctype, name, parentfield): if not (item.expense_account and item.cost_center): res = webnotes.conn.sql("""select expense_account, cost_center - from `tab%s` child where docstatus=1 and item_code=%s - ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' - and (select company from `tab%s` parent where parent.name=child.parent)=%s + from `tab%s` child where docstatus=1 and item_code=%s and + ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and + (select company from `tab%s` parent where parent.name=child.parent)=%s order by creation desc limit 1""" % (item.doctype, "%s", doctype, "%s"), (item.item_code, bean.doc.company)) if res: