Repost GL Entries for Journal Entries where reference name is missing
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index a98130b..acf5973 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -335,6 +335,7 @@
party: function(frm, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn);
if(!d.account && d.party_type && d.party) {
+ if(!frm.doc.company) frappe.throw(__("Please select Company"));
return frm.call({
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_party_account_and_balance",
child: d,
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 1d95904..5346a85 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -212,3 +212,4 @@
erpnext.patches.v5_8.tax_rule
erpnext.patches.v6_3.convert_applicable_territory
erpnext.patches.v6_4.round_status_updater_percentages
+erpnext.patches.v6_4.repost_gle_for_journal_entries_where_reference_name_missing
\ No newline at end of file
diff --git a/erpnext/patches/v6_4/repost_gle_for_journal_entries_where_reference_name_missing.py b/erpnext/patches/v6_4/repost_gle_for_journal_entries_where_reference_name_missing.py
new file mode 100644
index 0000000..e0268c4
--- /dev/null
+++ b/erpnext/patches/v6_4/repost_gle_for_journal_entries_where_reference_name_missing.py
@@ -0,0 +1,23 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ je_list = frappe.db.sql_list("""select distinct parent from `tabJournal Entry Account` je
+ where docstatus=1 and ifnull(reference_name, '') !='' and creation > '2015-03-01'
+ and not exists(select name from `tabGL Entry`
+ where voucher_type='Journal Entry' and voucher_no=je.parent
+ and against_voucher_type=je.reference_type
+ and against_voucher=je.reference_name)""")
+
+ for d in je_list:
+ print d
+
+ # delete existing gle
+ frappe.db.sql("delete from `tabGL Entry` where voucher_type='Journal Entry' and voucher_no=%s", d)
+
+ # repost gl entries
+ je = frappe.get_doc("Journal Entry", d)
+ je.make_gl_entries()
\ No newline at end of file