From 600bf9e24918f8a69a3ad04774d5fe9ea4b2337b Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 25 Jun 2026 16:15:33 +0530 Subject: [PATCH] fix: rewrite user-facing messages in Buying module Conservative cleanup of frappe.throw/msgprint messages per the message style guide; meaning, severity, and .format() arguments are unchanged: - index bare {} placeholders as {0}/{1}/... so translators can reorder - move f-strings / .format() / concatenation out of _() (they break gettext extraction and never translate) - wrap translatable dynamic values (DocType/Select labels) in _() - fix grammar and colloquialisms - drop no-op _() wrapping runtime-built strings Part of #53976. --- .../buying/doctype/purchase_order/services/subcontracting.py | 2 +- .../doctype/request_for_quotation/request_for_quotation.py | 2 +- .../supplier_scorecard_variable.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/services/subcontracting.py b/erpnext/buying/doctype/purchase_order/services/subcontracting.py index 13408596239..e9f6083f4b7 100644 --- a/erpnext/buying/doctype/purchase_order/services/subcontracting.py +++ b/erpnext/buying/doctype/purchase_order/services/subcontracting.py @@ -36,7 +36,7 @@ class SubcontractingService: ) ) if not item.fg_item_qty: - frappe.throw(_("Row #{0}: Finished Good Item Qty can not be zero").format(item.idx)) + frappe.throw(_("Row #{0}: Finished Good Item Qty cannot be zero").format(item.idx)) else: for item in doc.items: item.set("fg_item", None) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py index 36a2a84ac42..82a5b0c6103 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -421,7 +421,7 @@ def check_portal_enabled(reference_doctype): if not frappe.db.get_value("Portal Menu Item", {"reference_doctype": reference_doctype}, "enabled"): frappe.throw( _( - "The Access to Request for Quotation From Portal is Disabled. To Allow Access, Enable it in Portal Settings." + "Access to Request for Quotation from the portal is disabled. To allow access, enable it in Portal Settings." ) ) diff --git a/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py b/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py index 0700118c064..5657c719a61 100644 --- a/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py +++ b/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py @@ -43,11 +43,11 @@ class SupplierScorecardVariable(Document): import_string_path(self.path) except AttributeError: - frappe.throw(_("Could not find path for " + self.path), VariablePathNotFound) + frappe.throw(_("Could not find path for {0}").format(self.path), VariablePathNotFound) else: if not hasattr(sys.modules[__name__], self.path): - frappe.throw(_("Could not find path for " + self.path), VariablePathNotFound) + frappe.throw(_("Could not find path for {0}").format(self.path), VariablePathNotFound) def get_total_workdays(scorecard):