[FIX] stock: Fix strange ORM bidouille on picking creation

Purpose
=======

This bidouille on the ORM command seems to be from another age where the onchange on o2m list were not working well.

The issue is that _convert_to_write could return commands like (6, 0, []).

In that case the last tuple element is not dictionary, but a list.

Specification
=============

Fix that brol.
This commit is contained in:
Yannick Tivisse
2017-11-16 14:49:05 +01:00
parent aa13ed876e
commit 31e3a97577
+1 -1
View File
@@ -480,7 +480,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)