[PR #20974] [MERGED] Fixes #20912: Clear ModuleBay parent when module assignment removed #16105

Closed
opened 2025-12-30 00:25:49 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20974
Author: @jnovinger
Created: 12/12/2025
Status: Merged
Merged: 12/12/2025
Merged by: @arthanson

Base: mainHead: 20912-module-bay-parent-not-cleared


📝 Commits (1)

  • 413be72 Fixes #20912: Clear ModuleBay parent when module assignment removed

📊 Changes

2 files changed (+28 additions, -0 deletions)

View changed files

📝 netbox/dcim/models/device_components.py (+2 -0)
📝 netbox/dcim/tests/test_models.py (+26 -0)

📄 Description

Fixes: #20912

When a ModuleBay's module field is cleared (returning it to device-level), the parent field was not being updated, leaving stale MPTT tree data.

The save() method only set parent when module was present, but failed to clear it when module was removed. Now explicitly sets parent to None when module is cleared.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20974 **Author:** [@jnovinger](https://github.com/jnovinger) **Created:** 12/12/2025 **Status:** ✅ Merged **Merged:** 12/12/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `20912-module-bay-parent-not-cleared` --- ### 📝 Commits (1) - [`413be72`](https://github.com/netbox-community/netbox/commit/413be72f73c224e8c39e7cb8613e9aa9b5a5c429) Fixes #20912: Clear ModuleBay parent when module assignment removed ### 📊 Changes **2 files changed** (+28 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/models/device_components.py` (+2 -0) 📝 `netbox/dcim/tests/test_models.py` (+26 -0) </details> ### 📄 Description ### Fixes: #20912 When a ModuleBay's `module` field is cleared (returning it to device-level), the parent field was not being updated, leaving stale MPTT tree data. The `save()` method only set parent when module was present, but failed to clear it when module was removed. Now explicitly sets parent to None when module is cleared. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:25:49 +01:00
adam closed this issue 2025-12-30 00:25:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16105