From 72d2d682aedffaebab77314449331280256006c7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 30 Sep 2015 18:42:54 +0530 Subject: [PATCH] Repost GL Entries for Journal Entries where reference name is missing --- .../doctype/journal_entry/journal_entry.js | 1 + erpnext/patches.txt | 1 + ...al_entries_where_reference_name_missing.py | 23 +++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 erpnext/patches/v6_4/repost_gle_for_journal_entries_where_reference_name_missing.py diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index a98130bfc4..acf5973100 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -335,6 +335,7 @@ frappe.ui.form.on("Journal Entry Account", { 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 1d95904b79..5346a852d5 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -212,3 +212,4 @@ erpnext.patches.v6_2.fix_missing_default_taxes_and_lead 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 0000000000..e0268c42db --- /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