Skip to content

Commit

Permalink
patch: update outsanting in old payment schedule entries (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
agritheory authored Jan 3, 2024
1 parent e26bd46 commit a9e3e8b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions check_run/patches.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
check_run.patches.patch_payment_schedule # 12/19/23
17 changes: 17 additions & 0 deletions check_run/patches/patch_payment_schedule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import frappe


def execute():
pts = frappe.db.sql(
"""
SELECT `tabPayment Schedule`.parent, `tabPayment Schedule`.name
FROM `tabPayment Schedule`, `tabPurchase Invoice`
WHERE `tabPayment Schedule`.outstanding > 0.0
AND `tabPayment Schedule`.parent = `tabPurchase Invoice`.name
AND `tabPurchase Invoice`.status = 'Paid'
""",
as_dict=True,
)

for ps in pts:
frappe.db.set_value("Payment Schedule", ps.name, "outstanding", 0.0)

0 comments on commit a9e3e8b

Please sign in to comment.