chore: rewrite user-facing messages in Subcontracting 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.
This commit is contained in:
Mihir Kandoi
2026-06-25 16:21:28 +05:30
parent 7124e47490
commit f5bf915104
3 changed files with 13 additions and 8 deletions

View File

@@ -224,7 +224,7 @@ class SubcontractingInwardOrder(SubcontractingController):
if not any([rm.is_customer_provided_item for rm in raw_materials]):
frappe.throw(
_(
"Atleast one raw material for Finished Good Item {0} should be customer provided."
"At least one raw material for Finished Good Item {0} should be customer provided."
).format(frappe.bold(item.item_code))
)

View File

@@ -139,12 +139,14 @@ class SubcontractingOrder(SubcontractingController):
frappe.throw(_("Please select a valid Purchase Order that is configured for Subcontracting."))
if po.docstatus != 1:
msg = f"Please submit Purchase Order {po.name} before proceeding."
frappe.throw(_(msg))
frappe.throw(_("Please submit Purchase Order {0} before proceeding.").format(po.name))
if po.per_received == 100:
msg = f"Cannot create more Subcontracting Orders against the Purchase Order {po.name}."
frappe.throw(_(msg))
frappe.throw(
_("Cannot create more Subcontracting Orders against the Purchase Order {0}.").format(
po.name
)
)
else:
self.service_items = self.items = self.supplied_items = None
frappe.throw(_("Please select a Subcontracting Purchase Order."))
@@ -172,8 +174,11 @@ class SubcontractingOrder(SubcontractingController):
if self.supplier_warehouse:
for item in self.supplied_items:
if self.supplier_warehouse == item.reserve_warehouse:
msg = f"Reserve Warehouse must be different from Supplier Warehouse for Supplied Item {item.main_item_code}."
frappe.throw(_(msg))
frappe.throw(
_(
"Reserve Warehouse must be different from Supplier Warehouse for Supplied Item {0}."
).format(item.main_item_code)
)
def set_missing_values(self):
self.calculate_additional_costs()

View File

@@ -143,7 +143,7 @@ class SubcontractingReceipt(SubcontractingController):
self.validate_inspection()
if getdate(self.posting_date) > getdate(nowdate()):
frappe.throw(_("Posting Date cannot be future date"))
frappe.throw(_("Posting Date cannot be a future date"))
super().validate()