From 995b5c617b9236d13d96e8359c20c94b77824d2f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Nov 2012 19:40:37 +0530 Subject: [PATCH 1/4] Patch for fixing floating point issue in gl entry --- accounts/doctype/gl_control/gl_control.py | 3 +++ patches/patch_list.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/accounts/doctype/gl_control/gl_control.py b/accounts/doctype/gl_control/gl_control.py index 9dec4d5b0d..deb88f7d2f 100644 --- a/accounts/doctype/gl_control/gl_control.py +++ b/accounts/doctype/gl_control/gl_control.py @@ -141,6 +141,9 @@ class DocType: # ---------------- def save_entries(self, cancel, adv_adj, update_outstanding): for le in self.entries: + # round off upto 2 decimal + le.debit, le.credit = round(le.debit, 2), round(le.credit, 2) + #toggle debit, credit if negative entry if flt(le.debit) < 0 or flt(le.credit) < 0: tmp=le.debit diff --git a/patches/patch_list.py b/patches/patch_list.py index 93fc08d145..1e54d5b9b5 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -701,4 +701,8 @@ patch_list = [ 'patch_module': 'patches.november_2012', 'patch_file': 'production_order_patch', }, + { + 'patch_module': 'patches.november_2012', + 'patch_file': 'gle_floating_point_issue', + }, ] \ No newline at end of file From 0d2fddbc0644e3310757cd1f84d136afc636ced1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Nov 2012 19:40:52 +0530 Subject: [PATCH 2/4] Patch for fixing floating point issue in gl entry --- .../november_2012/gle_floating_point_issue.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 patches/november_2012/gle_floating_point_issue.py diff --git a/patches/november_2012/gle_floating_point_issue.py b/patches/november_2012/gle_floating_point_issue.py new file mode 100644 index 0000000000..c345152a3e --- /dev/null +++ b/patches/november_2012/gle_floating_point_issue.py @@ -0,0 +1,16 @@ +def execute(): + import webnotes + + webnotes.conn.sql("""update `tabGL Entry` + set debit = round(debit, 2), credit = round(credit, 2)""") + + gle = webnotes.conn.sql("""select voucher_type, voucher_no, + sum(ifnull(debit,0)) - sum(ifnull(credit, 0)) as diff + from `tabGL Entry` + group by voucher_type, voucher_no + having sum(ifnull(debit, 0)) != sum(ifnull(credit, 0))""", as_dict=1) + + for d in gle: + webnotes.conn.sql("""update `tabGL Entry` set debit = debit - %s + where voucher_type = %s and voucher_no = %s and debit > 0 limit 1""", + (d['diff'], d['voucher_type'], d['voucher_no'])) \ No newline at end of file From 2f1ede1a5f1277ed7aee48c47ddfbd175696cd2d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 30 Nov 2012 20:39:55 +0530 Subject: [PATCH 3/4] changed communication module to core in patch --- patches/november_2012/communication_sender_and_recipient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/november_2012/communication_sender_and_recipient.py b/patches/november_2012/communication_sender_and_recipient.py index c49bc9bcc9..f8d7a95cfe 100644 --- a/patches/november_2012/communication_sender_and_recipient.py +++ b/patches/november_2012/communication_sender_and_recipient.py @@ -1,7 +1,7 @@ import webnotes def execute(): - webnotes.reload_doc("support", "doctype", "communication") + webnotes.reload_doc("core", "doctype", "communication") webnotes.conn.sql("""update tabCommunication set sender=email_address where ifnull(support_ticket,'') != ''""") webnotes.conn.sql("""update tabCommunication set recipients=email_address where From 79ed5d8c35090f7c294ae237fca71fa85afee708 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sat, 1 Dec 2012 13:09:08 +0530 Subject: [PATCH 4/4] communication print format bugfix --- accounts/doctype/journal_voucher/journal_voucher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py index 01b68801ca..8b22f229e6 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.py +++ b/accounts/doctype/journal_voucher/journal_voucher.py @@ -54,9 +54,9 @@ class DocType: r = [] if self.doc.cheque_no : if self.doc.cheque_date: - r.append('Via cheque #%s dated %s' % (self.doc.cheque_no, formatdate(self.doc.cheque_date))) + r.append('Via Reference #%s dated %s' % (self.doc.cheque_no, formatdate(self.doc.cheque_date))) else : - msgprint("Please enter cheque date") + msgprint("Please enter Reference date") raise Exception for d in getlist(self.doclist, 'entries'):