Prevent ValueError when from location is a view

If the from location is a view, it may not be in the childs list.

issue9896
review316751002
This commit is contained in:
Cédric Krier
2021-01-08 22:57:47 +01:00
parent 5006ce2bac
commit 25906f28ff
+6 -2
View File
@@ -969,8 +969,12 @@ class Move(Workflow, ModelSQL, ModelView):
except ValueError:
pass
# Try first to pick from source location
childs.remove(move.from_location)
childs.insert(0, move.from_location)
try:
childs.remove(move.from_location)
childs.insert(0, move.from_location)
except ValueError:
# from_location may be a view
pass
index = {l.id: i for i, l in enumerate(childs)}
location_qties = []
pbl_items = pbl.items()