change devices of lots

This commit is contained in:
Cayo Puigdefabregas 2022-07-15 17:43:51 +02:00
parent ccc9abb835
commit 74260c6a00

View file

@ -60,6 +60,12 @@ def clone_device(device):
tags = [x for x in device.tags]
for tag in tags:
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