diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index 6f506d63f6..7b528bc90d 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)))