brotherton-erpnext/erpnext/patches/v5_4/fix_invoice_outstanding.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
588 B
Python
Raw Normal View History

# 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():
2015-08-04 05:18:05 +00:00
frappe.reload_doctype("Sales Invoice")
return_entries = frappe.get_list("Sales Invoice", filters={"is_return": 1, "docstatus": 1},
fields=["debit_to", "customer", "return_against"])
for d in return_entries:
2015-08-04 05:18:05 +00:00
update_outstanding_amt(d.debit_to, "Customer", d.customer, "Sales Invoice", d.return_against)