Fix invoice outstanding where party missing

Conflicts:
	erpnext/accounts/doctype/gl_entry/gl_entry.py
	erpnext/patches.txt
This commit is contained in:
Nabin Hait 2015-09-07 15:22:24 +05:30 committed by Anand Doshi
parent 96bb070781
commit 83a358afc1
2 changed files with 17 additions and 0 deletions

View File

@ -204,3 +204,4 @@ erpnext.patches.v6_0.set_default_title # 2015-09-03
erpnext.patches.v6_0.default_activity_rate
execute:frappe.db.set_value("Stock Settings", None, "automatically_set_serial_nos_based_on_fifo", 1)
execute:frappe.db.sql("""update `tabProject` set percent_complete=round(percent_complete, 2) where percent_complete is not null""")
erpnext.patches.v6_0.fix_outstanding_amount

View File

@ -0,0 +1,16 @@
# 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
from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
def execute():
for dt, party_field, account_field in (("Sales Invoice", "customer", "debit_to"),
("Purchase Invoice", "supplier", "credit_to")):
wrong_invoices = frappe.db.sql("""select name, {0} as account from `tab{1}`
where docstatus=1 and ifnull({2}, '')=''""".format(account_field, dt, party_field))
for invoice, account in wrong_invoices:
update_outstanding_amt(account, party_field.title(), None, dt, invoice)