diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index 0e03e331f1a..98f68d581a8 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