brotherton-erpnext/erpnext/patches/v13_0/update_payment_terms_outstanding.py
Saqib 0586b7db79
feat: discount configuration on early payments (#24586)
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
2021-03-31 15:03:53 +05:30

16 lines
405 B
Python

# 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)
''')