diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 8034bf2f714..560158fb955 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -1,7 +1,6 @@ # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -import functools import re from collections import deque @@ -1648,7 +1647,7 @@ def _set_default_accounts_for_items(item_dict, company): def get_bom_items(bom: str, company: str, qty: float = 1, fetch_exploded: int = 1): items = get_bom_items_as_dict(bom, company, qty, fetch_exploded, include_non_stock_items=True).values() items = list(items) - items.sort(key=functools.cmp_to_key(lambda a, b: a.item_code > b.item_code and 1 or -1)) + items.sort(key=lambda item: item.item_code) return items diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index c02bdd6259e..3b89f031c3a 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -149,8 +149,8 @@ class RepostItemValuation(Document): year_end_date = self.get_max_period_closing_date(self.company) if year_end_date and getdate(self.posting_date) <= getdate(year_end_date): date = frappe.format(year_end_date, "Date") - msg = f"Due to period closing, you cannot repost item valuation before {date}" - frappe.throw(_(msg)) + msg = _("Due to period closing, you cannot repost item valuation before {0}").format(date) + frappe.throw(msg) # Accounting Period if self.voucher_type: diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 57df17602a2..a4e727bb8e4 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1053,7 +1053,7 @@ class StockEntry(StockController, SubcontractingInwardController): if not finished_items: frappe.throw( - msg=_("There must be at least 1 Finished Good in this Stock Entry").format(self.name), + msg=_("There must be at least 1 Finished Good in this Stock Entry"), title=_("Missing Finished Good"), exc=FinishedGoodError, )