Skip to content

Commit

Permalink
Merge pull request #206 from ArnesSI/fix-snapshots
Browse files Browse the repository at this point in the history
ensure change snapshots are created for hardware
  • Loading branch information
matejv authored Dec 12, 2024
2 parents 0e90b2c + ab1a2bf commit 35de3f4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions netbox_inventory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ def update_hardware_used(self, clear_old_hw=True):
return None
old_hw = get_prechange_field(self, self.kind)
new_hw = getattr(self, self.kind)
if old_hw:
old_hw.snapshot()
if new_hw:
new_hw.snapshot()
old_serial = get_prechange_field(self, 'serial')
old_asset_tag = get_prechange_field(self, 'asset_tag')
if not new_hw and old_hw and clear_old_hw:
Expand Down

0 comments on commit 35de3f4

Please sign in to comment.