mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-18 10:46:31 +00:00
(cherry picked from commit 5c5549c233
)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2a7f5f94c8
commit
be04d0c4fc
@@ -641,7 +641,16 @@ class InvenTreeTree(MetadataMixin, PluginValidationMixin, MPTTModel):
|
|||||||
|
|
||||||
# 3. Update the tree structure
|
# 3. Update the tree structure
|
||||||
if tree_id:
|
if tree_id:
|
||||||
|
try:
|
||||||
self.__class__.objects.partial_rebuild(tree_id)
|
self.__class__.objects.partial_rebuild(tree_id)
|
||||||
|
except Exception:
|
||||||
|
logger.warning(
|
||||||
|
'Failed to rebuild tree for %s <%s>',
|
||||||
|
self.__class__.__name__,
|
||||||
|
self.pk,
|
||||||
|
)
|
||||||
|
# If the partial rebuild fails, rebuild the entire tree
|
||||||
|
self.__class__.objects.rebuild()
|
||||||
else:
|
else:
|
||||||
self.__class__.objects.rebuild()
|
self.__class__.objects.rebuild()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user