-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Staged Changes: InventoryItem Fails Sync #13422
Comments
@jeremystretch Happy to do the work on this but what do you think the best approach to solve this is? Add a keyword argument |
@minitriga it would probably suffice to force an MPTT recalculation after the merge. Unfortunately, with all the competing bug reports currently open, I'm not able to dedicate any time to this. Would you like to take ownership of this issue? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide. |
This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary. |
Reviving this as our customers need to sync models that are MPTT Models. Such as Location and Inventory Item. Recalculating didnt work so well as to rebuild the MPTT you have to have the items in the DB and the issue is adding them into the DB without the MPTT fields. |
Reopening and assigning since this remains valid and needed, and a PR is ready. |
Marking this as blocked by #16290, which when implemented should |
Now that #16290 has been completed, I can confirm that MPTT-enabled objects are created successfully upon merging the branch. However, they may not be ordered properly due to having outdated MPTT positional attributes. Calling |
NetBox version
v3.5.1
Python version
3.10
Steps to Reproduce
Currently when working with staged changes there is a edge-case where the staged changes failed on the merge.
I believe this is because of the serialiser removing key parts of the data required to recreate the device when
merge()
is called.netbox/netbox/netbox/staging.py
Line 119 in f5a1f83
And when
serialize_object
is called it removes all MPTT model fields:netbox/netbox/utilities/utils.py
Line 157 in f5a1f83
This causes the merge to fail because the MPTT fields are now null. In the staged changes table.
Error message:
Script to recreate:
Expected Behavior
If there is a serializer or argument to pass to the serializer that does not remove key fields to recreate objects from the staged changes table.
Observed Behavior
The serialized object has key fields removed which are required to save the object.
The text was updated successfully, but these errors were encountered: