changeset 0c0b9ef07215 in modules/stock:5.8
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=0c0b9ef07215
description:
        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
        (grafted from 584ab4cbb6b08419f27cd80f8d9ec12273fe08d5)
diffstat:

 move.py |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 2156943f552a -r 0c0b9ef07215 move.py
--- a/move.py   Fri Jan 01 16:39:21 2021 +0100
+++ b/move.py   Fri Jan 08 22:57:47 2021 +0100
@@ -973,8 +973,12 @@
             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()

Reply via email to