From 43a62ad0f0a8ed3d3131dc9b264c022bb125a919 Mon Sep 17 00:00:00 2001 From: Chris Ian Fiel Date: Thu, 21 Jan 2016 06:50:13 +0800 Subject: [PATCH 1/2] undo reconciled journal entry record --- .../doctype/bank_reconciliation/bank_reconciliation.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index 3c280bd2ddc..6f506d63f6e 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -55,6 +55,11 @@ class BankReconciliation(Document): frappe.db.sql("""update `tabJournal Entry` set clearance_date = %s, modified = %s where name=%s""", (d.clearance_date, nowdate(), d.voucher_id)) vouchers.append(d.voucher_id) + else: + frappe.db.set_value("Journal Entry", d.voucher_id, "clearance_date", None) + frappe.db.sql("""update `tabJournal Entry` set clearance_date = NULL , modified = %s + where name=%s""", (nowdate(), d.voucher_id)) + vouchers.append(d.voucher_id) if vouchers: msgprint("Clearance Date updated in: {0}".format(", ".join(vouchers))) From cb66d3a8c94051b1027cb6e3a61f9e639130b02d Mon Sep 17 00:00:00 2001 From: Chris Ian Fiel Date: Thu, 21 Jan 2016 16:26:22 +0800 Subject: [PATCH 2/2] undo reconciled journal entry record https://github.com/frappe/erpnext/issues/4661 --- .../doctype/bank_reconciliation/bank_reconciliation.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index 6f506d63f6e..7b528bc90dc 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -51,15 +51,11 @@ class BankReconciliation(Document): if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date): frappe.throw(_("Clearance date cannot be before check date in row {0}").format(d.idx)) + if d.clearance_date or self.include_reconciled_entries: frappe.db.set_value("Journal Entry", d.voucher_id, "clearance_date", d.clearance_date) frappe.db.sql("""update `tabJournal Entry` set clearance_date = %s, modified = %s where name=%s""", (d.clearance_date, nowdate(), d.voucher_id)) vouchers.append(d.voucher_id) - else: - frappe.db.set_value("Journal Entry", d.voucher_id, "clearance_date", None) - frappe.db.sql("""update `tabJournal Entry` set clearance_date = NULL , modified = %s - where name=%s""", (nowdate(), d.voucher_id)) - vouchers.append(d.voucher_id) if vouchers: msgprint("Clearance Date updated in: {0}".format(", ".join(vouchers)))