diff --git a/move.py b/move.py index b46d0085fd..8bf194e993 100644 --- a/move.py +++ b/move.py @@ -783,6 +783,9 @@ class Move(Workflow, ModelSQL, ModelView): database = transaction.database connection = transaction.connection + if not moves: + return True + if with_childs: locations = Location.search([ ('parent', 'child_of', diff --git a/tests/test_stock.py b/tests/test_stock.py index c0f3c9c180..63702e800e 100644 --- a/tests/test_stock.py +++ b/tests/test_stock.py @@ -786,6 +786,14 @@ class StockTestCase(ModuleTestCase): self.assertFalse(Move.assign_try(moves)) self.assertEqual([m.state for m in moves], ['assigned', 'draft']) + @with_transaction() + def test_assign_without_moves(self): + "Test Move assign_try with empty moves" + pool = Pool() + Move = pool.get('stock.move') + + self.assertTrue(Move.assign_try([])) + def suite(): suite = trytond.tests.test_tryton.suite()