Repost GL Entries for Journal Entries where reference name is missing

This commit is contained in:
Nabin Hait 2015-09-30 18:42:54 +05:30
parent 21f6ea6f7e
commit 72d2d682ae
3 changed files with 25 additions and 0 deletions

View File

@ -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,

View File

@ -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

View File

@ -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()