undo reconciled journal entry record

https://github.com/frappe/erpnext/issues/4661
This commit is contained in:
Chris Ian Fiel 2016-01-21 16:26:22 +08:00
parent 43a62ad0f0
commit cb66d3a8c9

View File

@ -51,15 +51,11 @@ class BankReconciliation(Document):
if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date): 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)) 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.set_value("Journal Entry", d.voucher_id, "clearance_date", d.clearance_date)
frappe.db.sql("""update `tabJournal Entry` set clearance_date = %s, modified = %s frappe.db.sql("""update `tabJournal Entry` set clearance_date = %s, modified = %s
where name=%s""", (d.clearance_date, nowdate(), d.voucher_id)) where name=%s""", (d.clearance_date, nowdate(), d.voucher_id))
vouchers.append(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: if vouchers:
msgprint("Clearance Date updated in: {0}".format(", ".join(vouchers))) msgprint("Clearance Date updated in: {0}".format(", ".join(vouchers)))