changeset 98c660e6695d in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=98c660e6695d
description:
Add test Move assign_try skips to_location
issue7856
review66541002
diffstat:
tests/test_stock.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 53 insertions(+), 0 deletions(-)
diffs (63 lines):
diff -r d57f046484b8 -r 98c660e6695d tests/test_stock.py
--- a/tests/test_stock.py Mon Feb 18 18:34:32 2019 +0100
+++ b/tests/test_stock.py Mon Feb 18 18:35:23 2019 +0100
@@ -1076,6 +1076,59 @@
self.assertEqual([m.state for m in moves], ['assigned', 'draft'])
@with_transaction()
+ def test_assign_try_skip_to_location(self):
+ "Test Move assign_try skip to_location"
+ pool = Pool()
+ Template = pool.get('product.template')
+ Product = pool.get('product.product')
+ Uom = pool.get('product.uom')
+ Location = pool.get('stock.location')
+ Move = pool.get('stock.move')
+
+ uom, = Uom.search([('name', '=', 'Meter')])
+ template = Template(
+ name='Test Move.assign_try',
+ type='goods',
+ list_price=Decimal(1),
+ default_uom=uom,
+ )
+ template.save()
+ product = Product(template=template.id)
+ product.save()
+
+ supplier, = Location.search([('code', '=', 'SUP')])
+ storage, = Location.search([('code', '=', 'STO')])
+ child, = Location.copy([storage], default={'parent': storage.id})
+
+ company = create_company()
+ with set_company(company):
+ move, = Move.create([{
+ 'product': product.id,
+ 'uom': uom.id,
+ 'quantity': 1,
+ 'from_location': supplier.id,
+ 'to_location': child.id,
+ 'company': company.id,
+ 'unit_price': Decimal(1),
+ 'currency': company.currency.id,
+ }])
+ Move.do([move])
+
+ move, = Move.create([{
+ 'product': product.id,
+ 'uom': uom.id,
+ 'quantity': 1,
+ 'from_location': storage.id,
+ 'to_location': child.id,
+ 'company': company.id,
+ 'unit_price': Decimal(1),
+ 'currency': company.currency.id,
+ }])
+
+ self.assertFalse(Move.assign_try([move]))
+ self.assertEqual(move.state, 'draft')
+
+ @with_transaction()
def test_assign_without_moves(self):
"Test Move assign_try with empty moves"
pool = Pool()