fix: do not translate root Item Group lookup key (backport #57390)

The root Item Group is looked up by its untranslated name.

(cherry picked from commit 7239e6ed8c)
(cherry picked from commit d197d5685e)
This commit is contained in:
Mihir Kandoi
2026-10-15 14:13:51 +05:30
parent 62e64f97aa
commit c527b6bd4e
@@ -33,8 +33,11 @@ class ItemGroup(NestedSet):
def validate(self):
if not self.parent_item_group and not frappe.flags.in_test:
if frappe.db.exists("Item Group", _("All Item Groups")):
self.parent_item_group = _("All Item Groups")
root = frappe.db.get_value(
"Item Group", {"parent_item_group": ("is", "not set"), "is_group": 1}, order_by="lft asc"
)
if root and root != self.name:
self.parent_item_group = root
self.validate_item_group_defaults()
self.check_item_tax()