Hi,
I have a question about this scorecard process.
I have some suppliers that do not deal with me very often, but that I need to evaluate, due to regulatory requirements.
How can I test this supplier only when there is a delivery or relationship with him?
An example below: The supplier X had some transactions with my company only in months 1,2,4 and 7. The system is actually generating these scores:
Instead of test only the months that really exist some purchase:
How can I change my weighting_funcion to allow this math?
Result 1:
({total_accepted_items} / {total_received_items})*100
if {total_received_items} > 0
else 100
This code above will give your supplier 100% score when there are no received items. weirdly, the If statement comes after the line of code that is run if the condition is true.
<statement if condition true>
if <condition>
else <statement if condition is false>
1 Like
Hey fishter,
Thanks for your answer.
My point is, this “else 100” (when the supplier doesn’t have any received items) will increase the score, in its average… otherwise, if I use “else 0”, the score will decrease…
So, the workaround we did was “else 50”. But it is so far from an ideal workaround…
I see your problem…
Unfortunately there doesn’t seem to be a way to reference the previous period’s score in order to “carry it forward”, or simply ignore a period with no useful data.
Yeap… So… nevermind, and thanks for your help!
After trying to understand GPT and ERPNext working together, I’ve found a possible solution to this issue/improvement:
def calculate_all_supplier_scorecard_variables():
supplier_scorecard_variables = frappe.get_all(“Supplier Scorecard Variable”, fields=[“name”, “frequency”, “calculation_method”, “scorecard_criteria”])
movement_weeks = []
# Iterate over supplier_scorecard_variables to find the weeks with movement in criteria
for index, variable in enumerate(supplier_scorecard_variables):
if variable.frequency == "Weekly":
criteria = json.loads(variable.scorecard_criteria)
week_has_movement = False
for c in criteria:
if c.get("has_movement"):
week_has_movement = True
break
if week_has_movement:
movement_weeks.append(index)
# Iterate over supplier_scorecard_variables again, but only perform calculation for weeks with movement
for i in movement_weeks:
variable = supplier_scorecard_variables[i]
if variable.calculation_method:
frappe.get_doc("Supplier Scorecard Variable", variable.name).calculate_variable()
Is that a possible solution?
Tks!