From 022ac5016034dc5872997d334b727d5fd6ec3d32 Mon Sep 17 00:00:00 2001 From: Deepak kumar Date: Tue, 24 Apr 2018 10:52:28 +0530 Subject: [PATCH] Reverse Journal Entry (#13637) * [Fix] #13605 * fixes codacy * minor changes * Added naming series for reverse journal entry * added reference_type and reference_name --- .../doctype/journal_entry/journal_entry.js | 21 ++++++++ .../doctype/journal_entry/journal_entry.json | 53 +++++++++++++++++-- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index 0e03e331f1..98f68d581a 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -23,6 +23,12 @@ frappe.ui.form.on("Journal Entry", { }, "fa fa-table"); } + if(frm.doc.docstatus==1 && frm.doc.naming_series=="JV-") { + frm.add_custom_button(__('Reverse Journal Entry'), function() { + return erpnext.journal_entry.reverse_journal_entry(frm); + }); + } + if (frm.doc.__islocal) { frm.add_custom_button(__('Quick Entry'), function() { return erpnext.journal_entry.quick_entry(frm); @@ -553,5 +559,20 @@ $.extend(erpnext.journal_entry, { }); } return { filters: filters }; + }, + + reverse_journal_entry: function(frm) { + var me = frm.doc; + for(var i=0; i