fix: do not translate root Item Group lookup key

_("All Item Groups") resolves in the session language, so for
non-English users the db.exists lookup missed the root (stored in
English) and new groups were saved parentless, becoming uneditable
second roots.

Closes #57345
This commit is contained in:
Mihir Kandoi
2026-07-23 12:50:08 +05:30
parent cff05687d9
commit 7239e6ed8c

View File

@@ -32,8 +32,8 @@ class ItemGroup(NestedSet):
def validate(self):
if not self.parent_item_group and not frappe.in_test:
if frappe.db.exists("Item Group", _("All Item Groups")):
self.parent_item_group = _("All Item Groups")
if frappe.db.exists("Item Group", "All Item Groups"):
self.parent_item_group = "All Item Groups"
self.validate_item_group_defaults()
self.check_item_tax()