Avoid computation for assign_try with no moves
issue6366 review31201002
This commit is contained in:
1 parent
74ba82b3e1
commit
34073750ed
2 files changed
+11
No files matched your search
@@ -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',
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user