[fix][patch] GL Entries for Journal Entries with multiple Party, merge entries considering party

This commit is contained in:
Nabin Hait 2015-06-01 16:21:25 +05:30
parent a19150ddaf
commit 11190268ab
3 changed files with 34 additions and 6 deletions

View File

@ -56,12 +56,13 @@ def merge_similar_entries(gl_map):
def check_if_in_list(gle, gl_map): def check_if_in_list(gle, gl_map):
for e in gl_map: for e in gl_map:
if e.account == gle.account and \ if e.account == gle.account \
cstr(e.get('against_voucher'))==cstr(gle.get('against_voucher')) \ and cstr(e.get('party_type'))==cstr(gle.get('party_type')) \
and cstr(e.get('against_voucher_type')) == \ and cstr(e.get('party'))==cstr(gle.get('party')) \
cstr(gle.get('against_voucher_type')) \ and cstr(e.get('against_voucher'))==cstr(gle.get('against_voucher')) \
and cstr(e.get('cost_center')) == cstr(gle.get('cost_center')): and cstr(e.get('against_voucher_type')) == cstr(gle.get('against_voucher_type')) \
return e and cstr(e.get('cost_center')) == cstr(gle.get('cost_center')):
return e
def save_entries(gl_map, adv_adj, update_outstanding): def save_entries(gl_map, adv_adj, update_outstanding):
validate_account_for_auto_accounting_for_stock(gl_map) validate_account_for_auto_accounting_for_stock(gl_map)

View File

@ -161,3 +161,4 @@ erpnext.patches.v5_0.set_footer_address
execute:frappe.db.set_value("Backup Manager", None, "send_backups_to_dropbox", 1 if frappe.db.get_value("Backup Manager", None, "upload_backups_to_dropbox") in ("Daily", "Weekly") else 0) execute:frappe.db.set_value("Backup Manager", None, "send_backups_to_dropbox", 1 if frappe.db.get_value("Backup Manager", None, "upload_backups_to_dropbox") in ("Daily", "Weekly") else 0)
execute:frappe.db.sql_list("delete from `tabDocPerm` where parent='Issue' and modified_by='Administrator' and role='Guest'") execute:frappe.db.sql_list("delete from `tabDocPerm` where parent='Issue' and modified_by='Administrator' and role='Guest'")
erpnext.patches.v5_0.update_item_and_description_again erpnext.patches.v5_0.update_item_and_description_again
erpnext.patches.v5_0.repost_gle_for_jv_with_multiple_party

View File

@ -0,0 +1,26 @@
# 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 par.name from `tabJournal Entry` par
where par.docstatus=1 and par.creation > '2015-03-01'
and (select count(distinct child.party) from `tabJournal Entry Account` child
where par.name=child.parent and ifnull(child.party, '') != '') > 1
""")
for d in je_list:
# 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()
if je_list:
print je_list