Repository: OCA/stock-logistics-warehouse

Issue:
[11.0] stock_move_location: travis is red
@sebalix stock_move_location is going red in tests, so 11.0 branch is in bad state:

https://travis-ci.org/OCA/stock-logistics-warehouse/jobs/487479800


Discussion:
@rousseldenis Yes I'll have a look

Resolving patch:
diff --git a/stock_move_location/__manifest__.py b/stock_move_location/__manifest__.py
--- a/stock_move_location/__manifest__.py
+++ b/stock_move_location/__manifest__.py
@@ -4,7 +4,7 @@
 
 {
     "name": "Move Stock Location",
-    "version": "11.0.1.0.0",
+    "version": "11.0.1.0.1",
     "author": "Julius Network Solutions, "
               "Odoo Community Association (OCA)",
     "summary": "This module allows to move all stock "
diff --git a/stock_move_location/wizard/stock_move_location.py b/stock_move_location/wizard/stock_move_location.py
--- a/stock_move_location/wizard/stock_move_location.py
+++ b/stock_move_location/wizard/stock_move_location.py
@@ -2,8 +2,6 @@
 # Copyright 2018 Camptocamp SA
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
 
-from itertools import groupby
-
 from odoo import api, fields, models
 
 
@@ -58,22 +56,21 @@ def _create_picking(self):
 
     @api.multi
     def group_lines(self):
-        sorted_lines = sorted(
-            self.stock_move_location_line_ids,
-            key=lambda x: x.product_id,
-        )
-        groups = groupby(sorted_lines, key=lambda x: x.product_id)
-        groups_dict = {}
-        for prod, lines in groups:
-            groups_dict[prod.id] = list(lines)
-        return groups_dict
+        lines_grouped = {}
+        for line in self.stock_move_location_line_ids:
+            lines_grouped.setdefault(
+                line.product_id.id,
+                self.env["wiz.stock.move.location.line"].browse(),
+            )
+            lines_grouped[line.product_id.id] |= line
+        return lines_grouped
 
     @api.multi
     def _create_moves(self, picking):
         self.ensure_one()
         groups = self.group_lines()
         moves = self.env["stock.move"]
-        for group, lines in groups.items():
+        for lines in groups.values():
             move = self._create_move(picking, lines)
             moves |= move
         return moves
@@ -82,14 +79,14 @@ def _get_move_values(self, picking, lines):
         # locations are same for the products
         location_from_id = lines[0].origin_location_id.id
         location_to_id = lines[0].destination_location_id.id
-        product_id = lines[0].product_id.id
+        product = lines[0].product_id
         product_uom_id = lines[0].product_uom_id.id
         qty = sum([x.move_quantity for x in lines])
         return {
-            "name": "test",
+            "name": product.display_name,
             "location_id": location_from_id,
             "location_dest_id": location_to_id,
-            "product_id": product_id,
+            "product_id": product.id,
             "product_uom": product_uom_id,
             "product_uom_qty": qty,
             "picking_id": picking.id,


Test patch:
diff --git a/stock_move_location/tests/test_move_location.py b/stock_move_location/tests/test_move_location.py
--- a/stock_move_location/tests/test_move_location.py
+++ b/stock_move_location/tests/test_move_location.py
@@ -30,10 +30,10 @@ def test_move_location_wizard(self):
             self.product_lots, self.internal_loc_1, 0, self.lot1,
         )
         self.check_product_amount(
-            self.product_lots, self.internal_loc_1, 0, self.lot1,
+            self.product_lots, self.internal_loc_1, 0, self.lot2,
         )
         self.check_product_amount(
-            self.product_lots, self.internal_loc_1, 0, self.lot1,
+            self.product_lots, self.internal_loc_1, 0, self.lot3,
         )
         self.check_product_amount(
             self.product_no_lots, self.internal_loc_2, 123,
@@ -42,10 +42,10 @@ def test_move_location_wizard(self):
             self.product_lots, self.internal_loc_2, 1, self.lot1,
         )
         self.check_product_amount(
-            self.product_lots, self.internal_loc_2, 1, self.lot1,
+            self.product_lots, self.internal_loc_2, 1, self.lot2,
         )
         self.check_product_amount(
-            self.product_lots, self.internal_loc_2, 1, self.lot1,
+            self.product_lots, self.internal_loc_2, 1, self.lot3,
         )
 
     def test_move_location_wizard_amount(self):