From e2fe8de637d0f17e1715dc256ac3b6cc46b2bf76 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 28 Mar 2013 15:30:41 +0530 Subject: [PATCH] patch: update against expense_account in purchase invoice --- .../march_2013/p10_update_against_expense_account.py | 11 +++++++++++ patches/patch_list.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 patches/march_2013/p10_update_against_expense_account.py 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 0000000000..d1bad5cfed --- /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 0c5427b52b..5eff17075c 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -219,4 +219,5 @@ patch_list = [ "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