patch: update against expense_account in purchase invoice
diff --git a/patches/march_2013/p10_update_against_expense_account.py b/patches/march_2013/p10_update_against_expense_account.py
new file mode 100644
index 0000000..d1bad5c
--- /dev/null
+++ b/patches/march_2013/p10_update_against_expense_account.py
@@ -0,0 +1,11 @@
+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:
+ pi_obj = get_obj("Purchase Invoice", pi[0], with_children=1)
+ pi_obj.set_against_expense_account()
+ webnotes.conn.set_value("Purchase Invoice", pi[0],
+ "against_expense_account", pi_obj.doc.against_expense_account)
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 0c5427b..5eff170 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -219,4 +219,5 @@
"execute:webnotes.bean('Style Settings').save() #2013-03-25",
"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)",
"patches.march_2013.p09_unset_user_type_partner",
+ "patches.march_2013.p10_update_against_expense_account",
]
\ No newline at end of file