[FIX] stock: do not crash move_lines return a tuple with empty list

Typically if you use an onchange method to retrieve values on the server
and convert them to write it will also try to write empty values like
[(6, 0, [])] and this will crash as it has also the length of 3 but no
dictionary but a list

closes odoo/odoo#27937
This commit is contained in:
Wolfgang Taferner
2018-10-18 12:05:35 +00:00
parent 4c65499cca
commit 66f8ffe729
+1 -1
View File
@@ -501,7 +501,7 @@ class Picking(models.Model):
# As it is a create the format will be a list of (0, 0, dict)
if vals.get('move_lines') and vals.get('location_id') and vals.get('location_dest_id'):
for move in vals['move_lines']:
if len(move) == 3:
if len(move) == 3 and move[0] == 0:
move[2]['location_id'] = vals['location_id']
move[2]['location_dest_id'] = vals['location_dest_id']
res = super(Picking, self).create(vals)