From 9ca7e5255b23db5e9ebeab00c9b5ff3573c65145 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 22 Dec 2011 15:05:14 +0530 Subject: [PATCH 1/4] Patch to update idx.. start idx from 1 --- erpnext/patches/update_0_idx.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 erpnext/patches/update_0_idx.py diff --git a/erpnext/patches/update_0_idx.py b/erpnext/patches/update_0_idx.py new file mode 100644 index 0000000000..9c31f1d664 --- /dev/null +++ b/erpnext/patches/update_0_idx.py @@ -0,0 +1,9 @@ +import webnotes +def execute(): + doc_type_list = webnotes.conn.sql("""SELECT DISTINCT parent FROM `tabDocField` where idx=0""") + for doc_type in doc_type_list: + if doc_type and doc_type[0]: + webnotes.conn.sql("""\ + UPDATE `tabDocField` SET idx=idx+1 + WHERE parent=%s + """, doc_type[0]) From f2f4c87bb6f04dcb879b72ddf68d6643be6a55a0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 22 Dec 2011 15:19:16 +0530 Subject: [PATCH 2/4] remove previous field property setter --- erpnext/patches/remove_previous_field_property_setter.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 erpnext/patches/remove_previous_field_property_setter.py diff --git a/erpnext/patches/remove_previous_field_property_setter.py b/erpnext/patches/remove_previous_field_property_setter.py new file mode 100644 index 0000000000..677188e624 --- /dev/null +++ b/erpnext/patches/remove_previous_field_property_setter.py @@ -0,0 +1,6 @@ +import webnotes +def execute(): + webnotes.conn.sql("""\ + DELETE FROM `tabProperty Setter` + WHERE property='previous_field' + """) From 7792d08408888a6fd8666eeede5610bb844109e6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 22 Dec 2011 17:23:11 +0530 Subject: [PATCH 3/4] Dont show bank balance if no ledger of type "Bank or Cash" --- erpnext/setup/doctype/email_digest/email_digest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index 5b760245e2..62b1e3e2e4 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -121,6 +121,8 @@ class DocType: #webnotes.msgprint(query) #webnotes.msgprint(res) result[query] = (res and len(res)==1) and res[0] or (res and res or None) + if result[query] is None: + del result[query] return result @@ -586,7 +588,7 @@ class DocType: }, 'bank_balance': { - 'table': 'bank_balance' in result and table({ + 'table': 'bank_balance' in result and result['bank_balance'] and table({ 'head': 'Bank Balance', 'body': [ [ @@ -658,7 +660,7 @@ class DocType: if self.doc.fields[k]: if k in result: table_list.append(body_dict[k]['table']) - elif k in ['collections', 'payments']: + elif k in ['collections', 'payments', 'bank_balance']: table_list.append(\ "
[" + \ k.capitalize() + \ From 94a18109d7690b8756995aadfd70e36ee0159495 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 22 Dec 2011 17:34:11 +0530 Subject: [PATCH 4/4] Fixed issue: If account of type "Bank or Cash" is not associated to any GL Entry, then it displays an alert in the email digest email body --- erpnext/setup/doctype/email_digest/email_digest.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index 62b1e3e2e4..3498a7f55f 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -660,12 +660,19 @@ class DocType: if self.doc.fields[k]: if k in result: table_list.append(body_dict[k]['table']) - elif k in ['collections', 'payments', 'bank_balance']: + elif k in ['collections', 'payments']: table_list.append(\ "
[" + \ k.capitalize() + \ - "]
Missing: Ledger of type 'Bank or Cash'\ + "]
Missing: Account of type 'Bank or Cash'\
") + elif k=='bank_balance': + table_list.append(\ + "
[" + \ + "Bank Balance" + \ + "]
Alert: GL Entry not found for Account of type 'Bank or Cash'\ +
") + i = 0 result = []