diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py index 8c835a29912..a6bab72b1d8 100644 --- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py +++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py @@ -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):