[fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491
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 160aa15..22017b4 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 @@
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: