[fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491

This commit is contained in:
Anand Doshi 2013-09-02 16:29:52 +05:30
parent c81eabe07b
commit d09039ae43

View File

@ -45,9 +45,9 @@ def recreate_gl_entries(doctype, name, parentfield):
if not (item.expense_account and item.cost_center): if not (item.expense_account and item.cost_center):
res = webnotes.conn.sql("""select expense_account, cost_center res = webnotes.conn.sql("""select expense_account, cost_center
from `tab%s` child where docstatus=1 and item_code=%s from `tab%s` child where docstatus=1 and item_code=%s and
ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and
and (select company from `tab%s` parent where parent.name=child.parent)=%s (select company from `tab%s` parent where parent.name=child.parent)=%s
order by creation desc limit 1""" % (item.doctype, "%s", doctype, "%s"), order by creation desc limit 1""" % (item.doctype, "%s", doctype, "%s"),
(item.item_code, bean.doc.company)) (item.item_code, bean.doc.company))
if res: if res: