Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: display all item rate stop messages #38289

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading