changeset 584ab4cbb6b0 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=584ab4cbb6b0
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
diffstat:

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

diffs (18 lines):

diff -r 11fff2385c04 -r 584ab4cbb6b0 move.py
--- a/move.py   Sun Dec 27 00:19:30 2020 +0100
+++ b/move.py   Fri Jan 08 22:57:47 2021 +0100
@@ -969,8 +969,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