Skip to content

Commit

Permalink
fix: display all item rate stop messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dj12djdjs committed Nov 23, 2023
1 parent c99c805 commit 1546be5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion erpnext/utilities/transaction_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def validate_rate_with_reference_doc(self, ref_details):
"Selling Settings", "None", ["maintain_same_rate_action", "role_to_override_stop_action"]
)

stop_actions = []
for ref_dt, ref_dn_field, ref_link_field in ref_details:
reference_names = [d.get(ref_link_field) for d in self.get("items") if d.get(ref_link_field)]
reference_details = self.get_reference_details(reference_names, ref_dt + " Item")
Expand All @@ -108,7 +109,7 @@ def validate_rate_with_reference_doc(self, ref_details):
if abs(flt(d.rate - ref_rate, d.precision("rate"))) >= 0.01:
if action == "Stop":
if role_allowed_to_override not in frappe.get_roles():
frappe.throw(
stop_actions.append(
_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4})").format(
d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate
)
Expand All @@ -121,6 +122,8 @@ def validate_rate_with_reference_doc(self, ref_details):
title=_("Warning"),
indicator="orange",
)
if stop_actions:
frappe.throw(stop_actions, as_list=True)

def get_reference_details(self, reference_names, reference_doctype):
return frappe._dict(
Expand Down

0 comments on commit 1546be5

Please sign in to comment.