mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 23:53:21 +00:00
fix: correct bom sorting and stock translations (#58605)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user