From bcce5b381abcc9408902c99135576488665e6375 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 8 Apr 2013 12:46:24 +0530 Subject: [PATCH 01/10] [aii] fixes --- setup/doctype/company/company.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js index 4682724532..489ed0ce68 100644 --- a/setup/doctype/company/company.js +++ b/setup/doctype/company/company.js @@ -88,9 +88,6 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["expenses_included_in_valuation"].get_query = cur_frm.fields_dict["stock_adjustment_account"].get_query; - - cur_frm.fields_dict["stock_delivered_but_not_billed"].get_query = - cur_frm.fields_dict["stock_in_hand_account"].get_query; cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) { return { From d35293de17cf6f98217909cd9b0088ff070e4bca Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 11:39:16 +0530 Subject: [PATCH 02/10] updated all role in some pages --- patches/april_2013/p04_update_role_in_pages.py | 11 +++++++++++ patches/patch_list.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 patches/april_2013/p04_update_role_in_pages.py diff --git a/patches/april_2013/p04_update_role_in_pages.py b/patches/april_2013/p04_update_role_in_pages.py new file mode 100644 index 0000000000..6a4ecc6548 --- /dev/null +++ b/patches/april_2013/p04_update_role_in_pages.py @@ -0,0 +1,11 @@ +import webnotes +import webnotes.model +def execute(): + for p in ["activity", "todo", "questions", "question-view"]: + pbean = webnotes.bean("Page", p) + pbean.doclist.append({ + "doctype": "Page Role", + "role": "All", + "parentfield": "roles" + }) + pbean.save() \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 181d6352ed..b29c2485db 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -236,4 +236,5 @@ patch_list = [ 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Modern") # 2013-04-02', 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Spartan") # 2013-04-02', "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", + "patches.april_2013.p04_update_role_in_pages", ] \ No newline at end of file From 832320dc15b2578ec2d02daf8b78a00c355485bf Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 11:43:03 +0530 Subject: [PATCH 03/10] fixed conflict --- patches/patch_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/patch_list.py b/patches/patch_list.py index 5a68cc7df0..b827c5b482 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -239,6 +239,6 @@ patch_list = [ 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Modern") # 2013-04-02', 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Spartan") # 2013-04-02', "patches.april_2013.p04_reverse_modules_list", - "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')" + "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", "patches.april_2013.p04_update_role_in_pages", ] \ No newline at end of file From 8022a439a8e86291f15ca1d64a57fcde4ad0d13a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 11:49:42 +0530 Subject: [PATCH 04/10] role added in some pages --- home/page/activity/activity.txt | 4 +-- .../april_2013/p04_update_role_in_pages.py | 13 ++++----- .../page/question_view/question_view.txt | 27 +++++++++++++------ utilities/page/questions/questions.txt | 27 +++++++++++++------ 4 files changed, 47 insertions(+), 24 deletions(-) diff --git a/home/page/activity/activity.txt b/home/page/activity/activity.txt index 57f4b7a082..f00fac1f46 100644 --- a/home/page/activity/activity.txt +++ b/home/page/activity/activity.txt @@ -1,8 +1,8 @@ [ { - "creation": "2012-06-14 18:44:56", + "creation": "2013-04-09 11:45:31", "docstatus": 0, - "modified": "2013-04-03 14:59:38", + "modified": "2013-04-09 11:47:32", "modified_by": "Administrator", "owner": "Administrator" }, diff --git a/patches/april_2013/p04_update_role_in_pages.py b/patches/april_2013/p04_update_role_in_pages.py index 6a4ecc6548..3959044876 100644 --- a/patches/april_2013/p04_update_role_in_pages.py +++ b/patches/april_2013/p04_update_role_in_pages.py @@ -3,9 +3,10 @@ import webnotes.model def execute(): for p in ["activity", "todo", "questions", "question-view"]: pbean = webnotes.bean("Page", p) - pbean.doclist.append({ - "doctype": "Page Role", - "role": "All", - "parentfield": "roles" - }) - pbean.save() \ No newline at end of file + if len(pbean.doclist) == 1: + pbean.doclist.append({ + "doctype": "Page Role", + "role": "All", + "parentfield": "roles" + }) + pbean.save() \ No newline at end of file diff --git a/utilities/page/question_view/question_view.txt b/utilities/page/question_view/question_view.txt index d6478524c3..87fd053732 100644 --- a/utilities/page/question_view/question_view.txt +++ b/utilities/page/question_view/question_view.txt @@ -1,20 +1,31 @@ [ { - "owner": "Administrator", + "creation": "2013-04-09 11:45:31", "docstatus": 0, - "creation": "2011-05-04 11:09:50", + "modified": "2013-04-09 11:47:24", "modified_by": "Administrator", - "modified": "2011-03-29 13:54:27" + "owner": "Administrator" }, { - "name": "__common__", + "doctype": "Page", "module": "Utilities", - "standard": "Yes", + "name": "__common__", "page_name": "Question View", - "doctype": "Page" + "standard": "Yes" }, { - "name": "question-view", - "doctype": "Page" + "doctype": "Page Role", + "name": "__common__", + "parent": "question-view", + "parentfield": "roles", + "parenttype": "Page", + "role": "All" + }, + { + "doctype": "Page", + "name": "question-view" + }, + { + "doctype": "Page Role" } ] \ No newline at end of file diff --git a/utilities/page/questions/questions.txt b/utilities/page/questions/questions.txt index 64aaa514d3..d17cbc4561 100644 --- a/utilities/page/questions/questions.txt +++ b/utilities/page/questions/questions.txt @@ -1,20 +1,31 @@ [ { - "owner": "Administrator", + "creation": "2013-04-09 11:45:31", "docstatus": 0, - "creation": "2011-05-04 11:09:49", + "modified": "2013-04-09 11:47:36", "modified_by": "Administrator", - "modified": "2011-03-29 13:53:57" + "owner": "Administrator" }, { - "name": "__common__", + "doctype": "Page", "module": "Utilities", - "standard": "Yes", + "name": "__common__", "page_name": "Questions", - "doctype": "Page" + "standard": "Yes" }, { - "name": "questions", - "doctype": "Page" + "doctype": "Page Role", + "name": "__common__", + "parent": "questions", + "parentfield": "roles", + "parenttype": "Page", + "role": "All" + }, + { + "doctype": "Page", + "name": "questions" + }, + { + "doctype": "Page Role" } ] \ No newline at end of file From 6de5eb466c3f122e11b55130e3220e7cef5243ce Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 11:52:18 +0530 Subject: [PATCH 05/10] role added in some pages --- utilities/page/questions/questions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/page/questions/questions.txt b/utilities/page/questions/questions.txt index d17cbc4561..e327ebfd18 100644 --- a/utilities/page/questions/questions.txt +++ b/utilities/page/questions/questions.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-04-09 11:45:31", + "creation": "2013-04-09 11:50:08", "docstatus": 0, - "modified": "2013-04-09 11:47:36", + "modified": "2013-04-09 11:52:08", "modified_by": "Administrator", "owner": "Administrator" }, From 807e4788d5a2745d11fe7814bc92af90c32a8b9f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 14:31:14 +0530 Subject: [PATCH 06/10] fixes in patches --- patches/march_2013/p07_update_valuation_rate.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/patches/march_2013/p07_update_valuation_rate.py b/patches/march_2013/p07_update_valuation_rate.py index 885fad6a35..eaeeac1990 100644 --- a/patches/march_2013/p07_update_valuation_rate.py +++ b/patches/march_2013/p07_update_valuation_rate.py @@ -2,13 +2,18 @@ import webnotes def execute(): webnotes.reload_doc("accounts", "doctype", "purchase_invoice_item") - + webnotes.conn.auto_commit_on_many_writes = True for purchase_invoice in webnotes.conn.sql_list("""select distinct parent from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(valuation_rate, 0)=0"""): pi = webnotes.get_obj("Purchase Invoice", purchase_invoice) - pi.calculate_taxes_and_totals() + try: + pi.calculate_taxes_and_totals() + except: + pass pi.update_raw_material_cost() pi.update_valuation_rate("entries") for item in pi.doclist.get({"parentfield": "entries"}): webnotes.conn.sql("""update `tabPurchase Invoice Item` set valuation_rate = %s where name = %s""", (item.valuation_rate, item.name)) + + webnotes.conn.auto_commit_on_many_writes = False \ No newline at end of file From 29f3ecd6b174674490654f58990fe7b1945c0d16 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 14:46:12 +0530 Subject: [PATCH 07/10] [patch] create chart of accounts if not created --- patches/patch_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/patch_list.py b/patches/patch_list.py index b827c5b482..23b18aee17 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -241,4 +241,5 @@ patch_list = [ "patches.april_2013.p04_reverse_modules_list", "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", "patches.april_2013.p04_update_role_in_pages", + "patches.april_2013.p05_create_chart_of_accounts" ] \ No newline at end of file From ead385e8a4b3d1b939fd903ab8cd462f582fabed Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 14:48:31 +0530 Subject: [PATCH 08/10] [patch] create chart of accounts if not created --- patches/patch_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/patch_list.py b/patches/patch_list.py index 23b18aee17..4c51e8d710 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -230,6 +230,7 @@ patch_list = [ "patches.march_2013.p11_update_attach_files", "patches.march_2013.p12_set_item_tax_rate_in_json", "patches.march_2013.p07_update_valuation_rate", + "patches.april_2013.p05_create_chart_of_accounts", "patches.march_2013.p08_create_aii_accounts", "patches.march_2013.p03_update_buying_amount", "patches.april_2013.p01_update_serial_no_valuation_rate", @@ -241,5 +242,4 @@ patch_list = [ "patches.april_2013.p04_reverse_modules_list", "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", "patches.april_2013.p04_update_role_in_pages", - "patches.april_2013.p05_create_chart_of_accounts" ] \ No newline at end of file From 3594873a638afe1364f19d0f0ff8eaae3b4ba2ee Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 14:49:00 +0530 Subject: [PATCH 09/10] [patch] create chart of accounts if not created --- patches/april_2013/p05_create_chart_of_accounts.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 patches/april_2013/p05_create_chart_of_accounts.py diff --git a/patches/april_2013/p05_create_chart_of_accounts.py b/patches/april_2013/p05_create_chart_of_accounts.py new file mode 100644 index 0000000000..3a38a2c863 --- /dev/null +++ b/patches/april_2013/p05_create_chart_of_accounts.py @@ -0,0 +1,7 @@ +import webnotes +def execute(): + for company in webnotes.conn.sql("select name from `tabCompany`"): + if not webnotes.conn.sql("select * from `tabAccount` where company = %s", company[0]): + webnotes.conn.sql("""update `tabCompany` set receivables_group = '', + payables_group = '' where name = %s""", company[0]) + webnotes.bean("Company", company[0]).save() \ No newline at end of file From 563903526818b6b1fd3cd4d01c4607e0fc21b38f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 14:56:30 +0530 Subject: [PATCH 10/10] [patch] create chart of accounts if not created --- patches/april_2013/p05_create_chart_of_accounts.py | 7 ------- patches/march_2013/p08_create_aii_accounts.py | 8 +++++++- patches/patch_list.py | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) delete mode 100644 patches/april_2013/p05_create_chart_of_accounts.py diff --git a/patches/april_2013/p05_create_chart_of_accounts.py b/patches/april_2013/p05_create_chart_of_accounts.py deleted file mode 100644 index 3a38a2c863..0000000000 --- a/patches/april_2013/p05_create_chart_of_accounts.py +++ /dev/null @@ -1,7 +0,0 @@ -import webnotes -def execute(): - for company in webnotes.conn.sql("select name from `tabCompany`"): - if not webnotes.conn.sql("select * from `tabAccount` where company = %s", company[0]): - webnotes.conn.sql("""update `tabCompany` set receivables_group = '', - payables_group = '' where name = %s""", company[0]) - webnotes.bean("Company", company[0]).save() \ No newline at end of file diff --git a/patches/march_2013/p08_create_aii_accounts.py b/patches/march_2013/p08_create_aii_accounts.py index ec186b47ff..30bfe9ef01 100644 --- a/patches/march_2013/p08_create_aii_accounts.py +++ b/patches/march_2013/p08_create_aii_accounts.py @@ -1,7 +1,7 @@ import webnotes def execute(): webnotes.reload_doc("setup", "doctype", "company") - + create_chart_of_accounts_if_not_exists() add_group_accounts() add_ledger_accounts() add_aii_cost_center() @@ -94,4 +94,10 @@ def add_aii_cost_center(): }) cc.insert() +def create_chart_of_accounts_if_not_exists(): + for company in webnotes.conn.sql("select name from `tabCompany`"): + if not webnotes.conn.sql("select * from `tabAccount` where company = %s", company[0]): + webnotes.conn.sql("""update `tabCompany` set receivables_group = '', + payables_group = '' where name = %s""", company[0]) + webnotes.bean("Company", company[0]).save() \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 4c51e8d710..b827c5b482 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -230,7 +230,6 @@ patch_list = [ "patches.march_2013.p11_update_attach_files", "patches.march_2013.p12_set_item_tax_rate_in_json", "patches.march_2013.p07_update_valuation_rate", - "patches.april_2013.p05_create_chart_of_accounts", "patches.march_2013.p08_create_aii_accounts", "patches.march_2013.p03_update_buying_amount", "patches.april_2013.p01_update_serial_no_valuation_rate",