mirror of
https://gitlab.com/datalifeit/trytond-stock_product_category_location
synced 2023-12-14 04:33:11 +01:00
parent
ac5e2fc1cf
commit
14f52a3c7c
|
@ -15,13 +15,12 @@ class StockProductCategoryLocationTestCase(ModuleTestCase):
|
|||
module = 'stock_product_category_location'
|
||||
|
||||
@with_transaction()
|
||||
def test0010_add_category_default_location(self):
|
||||
def test_add_category_default_location(self):
|
||||
"""Add the category default location for a warehouse"""
|
||||
pool = Pool()
|
||||
Location = pool.get('stock.location')
|
||||
Category = pool.get('product.category')
|
||||
CatLoc = pool.get('stock.product.category.location')
|
||||
transaction = Transaction()
|
||||
|
||||
storage, = Location.search([('code', '=', 'STO')])
|
||||
new_cat, = Category.create([{'name': 'CAT1'}])
|
||||
|
@ -31,10 +30,9 @@ class StockProductCategoryLocationTestCase(ModuleTestCase):
|
|||
'location': storage.id
|
||||
}
|
||||
CatLoc.create([cat_loc_rec])
|
||||
transaction.commit()
|
||||
|
||||
@with_transaction()
|
||||
def test0020category_location_unique(self):
|
||||
def test_category_location_unique(self):
|
||||
"""Check unique error"""
|
||||
pool = Pool()
|
||||
Location = pool.get('stock.location')
|
||||
|
@ -42,12 +40,14 @@ class StockProductCategoryLocationTestCase(ModuleTestCase):
|
|||
CatLoc = pool.get('stock.product.category.location')
|
||||
|
||||
storage, = Location.search([('code', '=', 'STO')])
|
||||
new_cat, = Category.search([('name', '=', 'CAT1')])
|
||||
new_cat, = Category.create([{'name': 'CAT1'}])
|
||||
cat_loc_rec = {
|
||||
'category': new_cat.id,
|
||||
'warehouse': storage.parent.id,
|
||||
'location': storage.id
|
||||
}
|
||||
CatLoc.create([cat_loc_rec])
|
||||
|
||||
with self.assertRaises(UserError) as cm:
|
||||
CatLoc.create([cat_loc_rec])
|
||||
self.assertEqual(
|
||||
|
|
Loading…
Reference in a new issue