Merge pull request #57115 from mihir-kandoi/fix/supplier-scorecard-month-end-idempotency

fix: duplicate scorecard period when supplier is created on a month end
This commit is contained in:
Mihir Kandoi
2026-07-14 10:55:59 +05:30
committed by GitHub

View File

@@ -201,14 +201,16 @@ def make_all_scorecards(docname: str):
while (start_date < todays) and (end_date <= todays):
# check to make sure there is no scorecard period already created
# (inclusive bounds: a single-day period — supplier created on a month's
# last day — must match its own window, else it is re-created every run)
scorecards = frappe.get_all(
"Supplier Scorecard Period",
fields=["name"],
filters={
"scorecard": docname,
"docstatus": 1,
"start_date": ["<", end_date],
"end_date": [">", start_date],
"start_date": ["<=", end_date],
"end_date": [">=", start_date],
},
order_by="end_date desc",
)