mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-12 06:01:46 +00:00
fix: prevent max recursion on supplier scorecard save
on_update() called self.save(), which re-enters on_update() via run_post_save_methods(), recursing indefinitely when make_all_scorecards() keeps returning newly created periods. Guard the re-save with an in_rescore flag so the nested on_update() short-circuits, while still running the full validate() once to refresh score and standings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -55,8 +55,12 @@ class SupplierScorecard(Document):
|
||||
self.update_standing()
|
||||
|
||||
def on_update(self):
|
||||
score = make_all_scorecards(self.name)
|
||||
if score > 0:
|
||||
# Guard against recursion: the save() below re-enters on_update().
|
||||
if self.flags.in_rescore:
|
||||
return
|
||||
if make_all_scorecards(self.name) > 0:
|
||||
# New periods were created; re-save to refresh score and standings.
|
||||
self.flags.in_rescore = True
|
||||
self.save()
|
||||
|
||||
def validate_standings(self):
|
||||
|
||||
Reference in New Issue
Block a user