diff --git a/erpnext/accounts/doctype/payment_schedule/payment_schedule.json b/erpnext/accounts/doctype/payment_schedule/payment_schedule.json index de9f5aa2ffb..37afa10abca 100644 --- a/erpnext/accounts/doctype/payment_schedule/payment_schedule.json +++ b/erpnext/accounts/doctype/payment_schedule/payment_schedule.json @@ -9,6 +9,7 @@ "description", "discount_percentage", "discounted_amount", + "outstanding", "column_break_3", "due_date", "invoice_portion", @@ -89,12 +90,18 @@ "fieldtype": "Currency", "label": "Discounted Amount", "read_only": 1 + }, + { + "fieldname": "outstanding", + "fieldtype": "Currency", + "label": "Outstanding", + "read_only": 1 } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2021-02-08 12:45:25.734948", + "modified": "2021-02-09 20:47:56.617701", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Schedule", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 342647aca79..dcf626995bc 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -757,3 +757,4 @@ erpnext.patches.v13_0.setup_fields_for_80g_certificate_and_donation erpnext.patches.v13_0.rename_membership_settings_to_non_profit_settings erpnext.patches.v12_0.create_taxable_value_field erpnext.patches.v12_0.add_company_link_to_einvoice_settings +erpnext.patches.v13_0.update_payment_terms_outstanding diff --git a/erpnext/patches/v13_0/update_payment_terms_outstanding.py b/erpnext/patches/v13_0/update_payment_terms_outstanding.py new file mode 100644 index 00000000000..4816b40250e --- /dev/null +++ b/erpnext/patches/v13_0/update_payment_terms_outstanding.py @@ -0,0 +1,15 @@ +# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors +# MIT License. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc("accounts", "doctype", "Payment Schedule") + if frappe.db.count('Payment Schedule'): + frappe.db.sql(''' + UPDATE + `tabPayment Schedule` ps + SET + ps.outstanding = (ps.payment_amount - ps.paid_amount) + ''')