Skip to content

fix: seed standard Item Groups under the existing tree root (backport #57616) - #57630

Merged
mihir-kandoi merged 2 commits into
version-16-hotfixfrom
mergify/bp/version-16-hotfix/pr-57616
Jul 30, 2026
Merged

fix: seed standard Item Groups under the existing tree root (backport #57616)#57630
mihir-kandoi merged 2 commits into
version-16-hotfixfrom
mergify/bp/version-16-hotfix/pr-57616

Conversation

@mergify

@mergify mergify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Closes #57581

install_fixtures always inserted "All Item Groups" as a parentless group. When the tree already had a root, ItemGroup.validate re-parented it, leaving a second group-root holding the standard groups while the real root held everything else.

Reproducible with the healthcare app on a non-English site: its after_install seeds the root as _("All Item Groups"), so a pt-BR site gets Todos os Grupos de Itens as the root before the setup wizard runs.

'Todos os Grupos de Itens' <- ''        (root)
  'Laboratory', 'Drug'
  'All Item Groups' (is_group=1)
    'Products', 'Raw Material', 'Services', 'Sub Assemblies', 'Consumable'

This predates #57390 — I reproduced it with the old translated-name lookup restored and got an identical tree, since _("All Item Groups") resolved to the same root. (The healthcare side is a separate bug: it should seed the untranslated name like install_fixtures does.)

Resolve the root once with get_root_of, falling back to the canonical English name on fresh installs, and use it for the root record's exists-guard and the standard groups' parent — same as Company.create_default_departments.

The patch merges an already-seeded "All Item Groups" into the root it sits under, lifting its children and repointing every link. It only fires when that node is a group whose parent is exactly the current root, and is a no-op on re-run.


This is an automatic backport of pull request #57616 done by Mergify.

install_fixtures always inserted "All Item Groups" as a parentless group.
On a site where another app had already created the root, ItemGroup.validate
re-parented it, leaving a second group-root that held the standard groups
while the real root held everything else.

This is reproducible with the healthcare app on a non-English site: its
after_install seeds the root as _("All Item Groups"), so a pt-BR site gets
"Todos os Grupos de Itens" as the root before the setup wizard runs. The
split predates #57390 -- the old translated-name lookup resolved to the same
root and produced an identical tree.

Resolve the root once with get_root_of (falling back to the canonical English
name on fresh installs) and use it for the root record's exists-guard and the
standard groups' parent, matching Company.create_default_departments.

Patch merges an already-seeded "All Item Groups" into the root it sits under,
lifting its children and repointing every link.

Closes #57581

(cherry picked from commit e7088d8)
@mergify
mergify Bot requested a review from ruthra-kumar as a code owner July 30, 2026 13:42
@mihir-kandoi
mihir-kandoi enabled auto-merge July 30, 2026 13:52
@mihir-kandoi
mihir-kandoi merged commit 9c86f98 into version-16-hotfix Jul 30, 2026
18 checks passed
@mihir-kandoi
mihir-kandoi deleted the mergify/bp/version-16-hotfix/pr-57616 branch July 30, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant