fix: correct bom sorting and stock translations (#58605)

This commit is contained in:
Pandiyan P
2026-08-31 16:56:42 +05:30
committed by GitHub
parent b36895a4c3
commit 0f14f8050f
3 changed files with 4 additions and 5 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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,
)