change devices of lots

This commit is contained in:
Cayo Puigdefabregas 2022-07-15 17:43:51 +02:00
parent ccc9abb835
commit 74260c6a00
1 changed files with 6 additions and 0 deletions

View File

@ -60,6 +60,12 @@ def clone_device(device):
tags = [x for x in device.tags] tags = [x for x in device.tags]
for tag in tags: for tag in tags:
tag.device = new_device tag.device = new_device
lots = [x for x in device.lots]
for lot in lots:
set_devices = lot.devices - {device}
set_devices.add(new_device)
lot.devices.update(set_devices)
return new_device return new_device