From 97f6843b1ce9806244b2572594e68b57fdcdaf82 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 17:43:36 +0530 Subject: [PATCH 1/6] removed print statements --- patches/december_2012/repost_ordered_qty.py | 4 +--- patches/february_2013/fix_outstanding.py | 6 +----- patches/january_2013/file_list_rename_returns.py | 3 --- patches/july_2012/repost_stock_due_to_wrong_packing_list.py | 3 --- patches/mar_2012/doctype_get_refactor.py | 2 -- patches/march_2013/p03_update_buying_amount.py | 3 --- patches/march_2013/p08_create_aii_accounts.py | 6 +++--- patches/may_2012/reload_sales_invoice_pf.py | 1 - patches/october_2012/fix_cancelled_gl_entries.py | 3 +-- 9 files changed, 6 insertions(+), 25 deletions(-) diff --git a/patches/december_2012/repost_ordered_qty.py b/patches/december_2012/repost_ordered_qty.py index c798b6cc7c..4b046f1838 100644 --- a/patches/december_2012/repost_ordered_qty.py +++ b/patches/december_2012/repost_ordered_qty.py @@ -10,8 +10,6 @@ def execute(): and po_item.item_code = %s and po_item.warehouse = %s """, (d[0], d[1])) - if flt(d[3]) != flt(ordered_qty[0][0]): - print d[3], ordered_qty[0][0] - + if flt(d[3]) != flt(ordered_qty[0][0]): webnotes.conn.sql("""update `tabBin` set ordered_qty = %s where name = %s""", (ordered_qty and ordered_qty[0][0] or 0, d[2])) \ No newline at end of file diff --git a/patches/february_2013/fix_outstanding.py b/patches/february_2013/fix_outstanding.py index 22a6ee1740..8afc63f511 100644 --- a/patches/february_2013/fix_outstanding.py +++ b/patches/february_2013/fix_outstanding.py @@ -17,8 +17,4 @@ def execute(): if ((r["against_voucher_type"]=='Sales Invoice' and flt(r["outstanding"]) >= 0) \ or (r["against_voucher_type"]=="Purchase Invoice" and flt(["outstanding"]) <= 0)): webnotes.conn.set_value(r["against_voucher_type"], r["against_voucher"], - "outstanding_amount", abs(flt(r["outstanding"]))) - else: - print r["against_voucher_type"], r["against_voucher"], \ - outstanding[0][1], abs(flt(r["outstanding"])) - \ No newline at end of file + "outstanding_amount", abs(flt(r["outstanding"]))) \ No newline at end of file diff --git a/patches/january_2013/file_list_rename_returns.py b/patches/january_2013/file_list_rename_returns.py index cca7a15725..f897d5c4ec 100644 --- a/patches/january_2013/file_list_rename_returns.py +++ b/patches/january_2013/file_list_rename_returns.py @@ -34,10 +34,8 @@ def execute(): except Exception, e: # if duplicate entry, then dont update if e[0]!=1062: - print webnotes.getTraceback() raise e - print change_map changed_keys = change_map.keys() @@ -61,6 +59,5 @@ def execute(): except Exception, e: if e[0]!=1146: - print webnotes.getTraceback() raise e \ No newline at end of file diff --git a/patches/july_2012/repost_stock_due_to_wrong_packing_list.py b/patches/july_2012/repost_stock_due_to_wrong_packing_list.py index 81c6415644..615d7ed610 100644 --- a/patches/july_2012/repost_stock_due_to_wrong_packing_list.py +++ b/patches/july_2012/repost_stock_due_to_wrong_packing_list.py @@ -23,7 +23,6 @@ def repost_reserved_qty(): i = 0 for d in bins: i += 1 - print i reserved_qty = webnotes.conn.sql(""" select sum((dnpi_qty / so_item_qty) * (so_item_qty - so_item_delivered_qty)) @@ -54,7 +53,6 @@ def repost_reserved_qty(): """, (d[0], d[1])) if flt(d[3]) != flt(reserved_qty[0][0]): - print d[3], reserved_qty[0][0] webnotes.conn.sql(""" update `tabBin` set reserved_qty = %s where name = %s """, (reserved_qty and reserved_qty[0][0] or 0, d[2])) @@ -77,7 +75,6 @@ def cleanup_wrong_sle(): ) """) if sle: - print sle for d in sle: webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3]) create_comment(d[3]) diff --git a/patches/mar_2012/doctype_get_refactor.py b/patches/mar_2012/doctype_get_refactor.py index c6bfb3129c..26402292b4 100644 --- a/patches/mar_2012/doctype_get_refactor.py +++ b/patches/mar_2012/doctype_get_refactor.py @@ -24,7 +24,6 @@ def handle_custom_fields(): * Create property setter entry of previous field * Remove custom fields from tabDocField """ - print "in handle custom fields" cf = get_cf() assign_idx(cf) create_prev_field_prop_setter(cf) @@ -120,7 +119,6 @@ def create_file_list(): webnotes.clear_cache(doctype=obj.doc.name) def change_to_decimal(): - print "in change to decimal" webnotes.conn.commit() tables = webnotes.conn.sql("SHOW TABLES") alter_tables_list = [] diff --git a/patches/march_2013/p03_update_buying_amount.py b/patches/march_2013/p03_update_buying_amount.py index 0d96feba4a..92b171f3e1 100644 --- a/patches/march_2013/p03_update_buying_amount.py +++ b/patches/march_2013/p03_update_buying_amount.py @@ -7,7 +7,6 @@ def execute(): webnotes.conn.auto_commit_on_many_writes = True for company in webnotes.conn.sql("select name from `tabCompany`"): - print company[0] stock_ledger_entries = webnotes.conn.sql("""select item_code, voucher_type, voucher_no, voucher_detail_no, posting_date, posting_time, stock_value, warehouse, actual_qty as qty from `tabStock Ledger Entry` @@ -17,7 +16,6 @@ def execute(): dn_list = webnotes.conn.sql("""select name from `tabDelivery Note` where docstatus < 2 and company = %s""", company[0]) - print "Total Delivery Note: ", len(dn_list) for dn in dn_list: dn = webnotes.get_obj("Delivery Note", dn[0], with_children = 1) @@ -25,7 +23,6 @@ def execute(): si_list = webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus < 2 and company = %s""", company[0]) - print "Total Sales Invoice: ", len(si_list) for si in si_list: si = webnotes.get_obj("Sales Invoice", si[0], with_children = 1) si.set_buying_amount(stock_ledger_entries) diff --git a/patches/march_2013/p08_create_aii_accounts.py b/patches/march_2013/p08_create_aii_accounts.py index 30bfe9ef01..ac563b52fa 100644 --- a/patches/march_2013/p08_create_aii_accounts.py +++ b/patches/march_2013/p08_create_aii_accounts.py @@ -56,8 +56,8 @@ def add_accounts(accounts_to_add, check_fn=None): where company=%s and ifnull(parent_account, '')=''""", company)[0][0] if count > 4: - print "Company", company, \ - "has more than 4 root accounts. cannot apply patch to this company." + webnotes.errprint("Company" + company + + "has more than 4 root accounts. cannot apply patch to this company.") continue for account_name, parent_account_name, group_or_ledger, account_type in accounts_to_add: @@ -82,7 +82,7 @@ def add_aii_cost_center(): {"parent_cost_center['']": '', "company_name": company}) if not parent_cost_center: - print "Company", company, "does not have a root cost center" + webnotes.errprint("Company " + company + "does not have a root cost center") continue cc = webnotes.bean({ diff --git a/patches/may_2012/reload_sales_invoice_pf.py b/patches/may_2012/reload_sales_invoice_pf.py index b784469d00..ea4f5dfde5 100644 --- a/patches/may_2012/reload_sales_invoice_pf.py +++ b/patches/may_2012/reload_sales_invoice_pf.py @@ -12,6 +12,5 @@ def execute(): 'Sales Invoice Spartan', 'Sales Invoice Modern' ]: - print r.get('name') webnotes.modules.reload_doc(r.get('module'), 'Print Format', r.get('name')) \ No newline at end of file diff --git a/patches/october_2012/fix_cancelled_gl_entries.py b/patches/october_2012/fix_cancelled_gl_entries.py index 9d23619d93..5c23ce8835 100644 --- a/patches/october_2012/fix_cancelled_gl_entries.py +++ b/patches/october_2012/fix_cancelled_gl_entries.py @@ -12,5 +12,4 @@ def execute(): where voucher_type = %s and voucher_no = %s""", (entry['voucher_type'], entry['voucher_no'])) except Exception, e: - print entry - print e + pass \ No newline at end of file From 1175227c089ed8ea418f3167ecbaaf09aaa5424e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Apr 2013 11:48:27 +0530 Subject: [PATCH 2/6] [fixes] commented a patch as it is not needed --- 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 b827c5b482..ca80d94e61 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -231,7 +231,7 @@ patch_list = [ "patches.march_2013.p12_set_item_tax_rate_in_json", "patches.march_2013.p07_update_valuation_rate", "patches.march_2013.p08_create_aii_accounts", - "patches.march_2013.p03_update_buying_amount", + # "patches.march_2013.p03_update_buying_amount", "patches.april_2013.p01_update_serial_no_valuation_rate", "patches.april_2013.p02_add_country_and_currency", "patches.april_2013.p03_fixes_for_lead_in_quotation", From 0b80883088100ba4d23b559248f33a2a2e04d602 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 10 Apr 2013 15:28:23 +0530 Subject: [PATCH 3/6] [lead] [permission] cleanup of permission --- selling/doctype/lead/lead.txt | 71 +++++------------------------------ 1 file changed, 10 insertions(+), 61 deletions(-) diff --git a/selling/doctype/lead/lead.txt b/selling/doctype/lead/lead.txt index e162551607..2463f017c6 100644 --- a/selling/doctype/lead/lead.txt +++ b/selling/doctype/lead/lead.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-28 17:07:01", + "creation": "2013-04-10 11:45:37", "docstatus": 0, - "modified": "2013-03-26 14:05:01", + "modified": "2013-04-10 11:49:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -23,13 +23,18 @@ "permlevel": 0 }, { + "amend": 0, + "create": 1, "doctype": "DocPerm", "name": "__common__", "parent": "Lead", "parentfield": "permissions", "parenttype": "DocType", + "permlevel": 0, "read": 1, - "submit": 0 + "report": 1, + "submit": 0, + "write": 1 }, { "doctype": "DocType", @@ -445,69 +450,13 @@ "label": "Blog Subscriber" }, { - "create": 1, - "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "role": "Guest", - "write": 1 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "report": 0, - "role": "Sales User", - "write": 0 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "report": 0, - "role": "Sales Manager", - "write": 0 - }, - { - "amend": 0, "cancel": 1, - "create": 1, "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "role": "Sales Manager", - "write": 1 + "role": "Sales Manager" }, { - "amend": 0, "cancel": 0, - "create": 1, "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "role": "Sales User", - "write": 1 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "role": "All" - }, - { - "amend": 0, - "cancel": 0, - "create": 1, - "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "role": "System Manager", - "write": 1 + "role": "Sales User" } ] \ No newline at end of file From cad5c3414f32ef52d75437fe6417bab3954ef15a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 10 Apr 2013 15:28:42 +0530 Subject: [PATCH 4/6] [serial no] [fix] removed transaction date passed for creating stock ledger entry --- stock/doctype/serial_no/serial_no.py | 1 - 1 file changed, 1 deletion(-) diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py index 65bd2dd9c6..bbf55b35e3 100644 --- a/stock/doctype/serial_no/serial_no.py +++ b/stock/doctype/serial_no/serial_no.py @@ -79,7 +79,6 @@ class DocType(StockController): values = [{ 'item_code' : self.doc.item_code, 'warehouse' : self.doc.warehouse, - 'transaction_date' : nowdate(), 'posting_date' : self.doc.purchase_date or (self.doc.creation and self.doc.creation.split(' ')[0]) or nowdate(), 'posting_time' : self.doc.purchase_time or '00:00', 'voucher_type' : 'Serial No', From 54cab9cded1df56cbd56494083edc6e37a35df9d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Apr 2013 16:04:18 +0530 Subject: [PATCH 5/6] [fixes] fixes in general ledger grid report --- accounts/page/general_ledger/general_ledger.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/accounts/page/general_ledger/general_ledger.js b/accounts/page/general_ledger/general_ledger.js index 4a3f21ea92..4a39d74554 100644 --- a/accounts/page/general_ledger/general_ledger.js +++ b/accounts/page/general_ledger/general_ledger.js @@ -306,10 +306,8 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({ }, make_account_by_name: function() { - if(!this.account_by_name) { - this.account_by_name = this.make_name_map(wn.report_dump.data["Account"]); - this.make_voucher_acconuts_map(); - } + this.account_by_name = this.make_name_map(wn.report_dump.data["Account"]); + this.make_voucher_acconuts_map(); }, make_voucher_acconuts_map: function() { From e33f827e32d1c076a5ee76a922f32d68fa687818 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 10 Apr 2013 19:33:57 +0530 Subject: [PATCH 6/6] [modules] [fix] patch for storing only hidden modules --- patches/april_2013/p04_reverse_modules_list.py | 5 +++-- patches/april_2013/p05_fixes_in_reverse_modules.py | 10 ++++++++++ patches/patch_list.py | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 patches/april_2013/p05_fixes_in_reverse_modules.py diff --git a/patches/april_2013/p04_reverse_modules_list.py b/patches/april_2013/p04_reverse_modules_list.py index 9215fea5d9..1751d36ca2 100644 --- a/patches/april_2013/p04_reverse_modules_list.py +++ b/patches/april_2013/p04_reverse_modules_list.py @@ -6,6 +6,7 @@ def execute(): ml = json.loads(webnotes.conn.get_global("modules_list") or "[]") - webnotes.conn.set_global("hidden_modules", - json.dumps(list(set(modules.keys()).difference(set(ml))))) + if ml: + webnotes.conn.set_global("hidden_modules", + json.dumps(list(set(modules.keys()).difference(set(ml))))) \ No newline at end of file diff --git a/patches/april_2013/p05_fixes_in_reverse_modules.py b/patches/april_2013/p05_fixes_in_reverse_modules.py new file mode 100644 index 0000000000..8f5b2f773e --- /dev/null +++ b/patches/april_2013/p05_fixes_in_reverse_modules.py @@ -0,0 +1,10 @@ +import webnotes, json +import webnotes.utils + +def execute(): + modules = webnotes.get_config().modules + + ml = json.loads(webnotes.conn.get_global("hidden_modules")) + + if len(ml) == len(modules.keys()): + webnotes.conn.set_global("hidden_modules", json.dumps([])) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index ca80d94e61..be7e5cb3b9 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_fixes_in_reverse_modules", ] \ No newline at end of file