From 433cdc960d5c7a3c01ea9329c8264e73a774a4fa Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 31 Jul 2015 15:10:37 +0530 Subject: [PATCH] Update outstanding in original invoice from return invoice --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index f581faab13..6d76b5322f 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -439,7 +439,7 @@ class SalesInvoice(SellingController): if gl_entries: from erpnext.accounts.general_ledger import make_gl_entries - # if POS and amount is written off, there's no outstanding and hence no need to update it + # if POS and amount is written off, updating outstanding amt after posting all gl entries update_outstanding = "No" if (cint(self.is_pos) or self.write_off_account) else "Yes" make_gl_entries(gl_entries, cancel=(self.docstatus == 2), @@ -447,7 +447,8 @@ class SalesInvoice(SellingController): if update_outstanding == "No": from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt - update_outstanding_amt(self.debit_to, "Customer", self.customer, self.doctype, self.name) + update_outstanding_amt(self.debit_to, "Customer", self.customer, + self.doctype, self.return_against if cint(self.is_return) else self.name) if repost_future_gle and cint(self.update_stock) \ and cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):