From 114dc6757107c9169aadbcca7737f6ef0db1fb04 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 26 Mar 2013 17:20:31 +0100 Subject: [PATCH 1/2] [patch] [fix] --- patches/february_2013/p03_material_request.py | 8 ++++---- patches/patch_list.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/patches/february_2013/p03_material_request.py b/patches/february_2013/p03_material_request.py index 1a9a433ffe..66b2bf6cbb 100644 --- a/patches/february_2013/p03_material_request.py +++ b/patches/february_2013/p03_material_request.py @@ -3,10 +3,10 @@ import webnotes, os, sys def execute(): webnotes.reload_doc("core", "doctype", "doctype") - tables = webnotes.conn.sql_list("sthow tables") - if not "Material Request Item" in tables: + tables = webnotes.conn.sql_list("show tables") + if not "tabMaterial Request Item" in tables: webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True) - if not "Material Request" in tables: + if not "tabMaterial Request" in tables: webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True) webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_bill") webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_receive") @@ -22,4 +22,4 @@ def execute(): os.system("rm -rf app/hr/doctype/holiday_block_list") os.system("rm -rf app/hr/doctype/holiday_block_list_allow") os.system("rm -rf app/hr/doctype/holiday_block_list_date") - \ No newline at end of file + diff --git a/patches/patch_list.py b/patches/patch_list.py index 0c5427b52b..00d6572060 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -216,7 +216,8 @@ patch_list = [ "patches.march_2013.p06_remove_sales_purchase_return_tool", "execute:webnotes.bean('Global Defaults').save()", "patches.march_2013.p07_update_project_in_stock_ledger", + "execute:webnotes.reload_doc('setup', 'doctype', 'item_group') #2013-03-25", "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", -] \ No newline at end of file +] From e35073157c782c2cddbb3d535b3999b07017a39f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 27 Mar 2013 17:35:23 +0530 Subject: [PATCH 2/2] set fiscal year in stock entry and stock reconciliation --- .../p10_set_fiscal_year_for_stock.py | 18 ++++++++++++++++++ patches/patch_list.py | 5 +++++ 2 files changed, 23 insertions(+) create mode 100644 patches/march_2013/p10_set_fiscal_year_for_stock.py diff --git a/patches/march_2013/p10_set_fiscal_year_for_stock.py b/patches/march_2013/p10_set_fiscal_year_for_stock.py new file mode 100644 index 0000000000..c9d520279a --- /dev/null +++ b/patches/march_2013/p10_set_fiscal_year_for_stock.py @@ -0,0 +1,18 @@ +import webnotes +from accounts.utils import get_fiscal_year, FiscalYearError + +def execute(): + webnotes.reload_doc("stock", "doctype", "stock_entry") + webnotes.reload_doc("stock", "doctype", "stock_reconciliation") + + for doctype in ["Stock Entry", "Stock Reconciliation"]: + for name, posting_date in webnotes.conn.sql("""select name, posting_date from `tab%s` + where ifnull(fiscal_year,'')='' and docstatus=1""" % doctype): + try: + fiscal_year = get_fiscal_year(posting_date, 0)[0] + webnotes.conn.sql("""update `tab%s` set fiscal_year=%s where name=%s""" % \ + (doctype, "%s", "%s"), (fiscal_year, name)) + except FiscalYearError: + pass + + \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 0c5427b52b..2ea10cd308 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -216,7 +216,12 @@ patch_list = [ "patches.march_2013.p06_remove_sales_purchase_return_tool", "execute:webnotes.bean('Global Defaults').save()", "patches.march_2013.p07_update_project_in_stock_ledger", + "execute:webnotes.reload_doc('stock', 'doctype', 'item') #2013-03-25", + "execute:webnotes.reload_doc('setup', 'doctype', 'item_group') #2013-03-25", + "execute:webnotes.reload_doc('website', 'doctype', 'blog_post') #2013-03-25", + "execute:webnotes.reload_doc('website', 'doctype', 'web_page') #2013-03-25", "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_set_fiscal_year_for_stock", ] \ No newline at end of file