2013-03-28 10:00:41 +00:00
|
|
|
def execute():
|
|
|
|
import webnotes
|
|
|
|
from webnotes import get_obj
|
|
|
|
pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice`
|
|
|
|
where docstatus = 1 and ifnull(against_expense_account, '') = ''""")
|
|
|
|
|
|
|
|
for pi in pi_list:
|
2013-04-01 11:53:43 +00:00
|
|
|
pi_obj = get_obj("Purchase Invoice", pi[0], with_children=1)
|
|
|
|
pi_obj.set_against_expense_account()
|
|
|
|
webnotes.conn.sql("""update `tabPurchase Invoice` set against_expense_account = %s
|
|
|
|
where name = %s""", (pi_obj.doc.against_expense_account, pi[0]))
|