test: add context to product-create
This commit is contained in:
parent
8f12741d76
commit
ebb6d71be3
3 changed files with 55 additions and 42 deletions
|
@ -80,6 +80,7 @@ class AssetTestCase(object):
|
||||||
Asset = Pool().get('investment.asset')
|
Asset = Pool().get('investment.asset')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
@ -111,6 +112,7 @@ class AssetTestCase(object):
|
||||||
Asset = Pool().get('investment.asset')
|
Asset = Pool().get('investment.asset')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
@ -141,6 +143,7 @@ class AssetTestCase(object):
|
||||||
Asset = Pool().get('investment.asset')
|
Asset = Pool().get('investment.asset')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product1 = self.prep_asset_product(
|
product1 = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
@ -223,6 +226,7 @@ class AssetTestCase(object):
|
||||||
cursor = Transaction().connection.cursor()
|
cursor = Transaction().connection.cursor()
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
@ -289,6 +293,7 @@ class AssetTestCase(object):
|
||||||
Asset = Pool().get('investment.asset')
|
Asset = Pool().get('investment.asset')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
@ -399,6 +404,7 @@ class AssetTestCase(object):
|
||||||
Asset = Pool().get('investment.asset')
|
Asset = Pool().get('investment.asset')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
@ -484,6 +490,7 @@ class AssetTestCase(object):
|
||||||
OnlineSource = pool.get('investment.source')
|
OnlineSource = pool.get('investment.source')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
@ -521,6 +528,7 @@ class AssetTestCase(object):
|
||||||
Asset = pool.get('investment.asset')
|
Asset = pool.get('investment.asset')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
@ -626,6 +634,7 @@ class AssetTestCase(object):
|
||||||
Asset = pool.get('investment.asset')
|
Asset = pool.get('investment.asset')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product1 = self.prep_asset_product(
|
product1 = self.prep_asset_product(
|
||||||
name='Product unit', unit='u')
|
name='Product unit', unit='u')
|
||||||
product2 = self.prep_asset_product(
|
product2 = self.prep_asset_product(
|
||||||
|
@ -733,6 +742,7 @@ class AssetTestCase(object):
|
||||||
""" check update of product on asset
|
""" check update of product on asset
|
||||||
"""
|
"""
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product1 = self.prep_asset_product(
|
product1 = self.prep_asset_product(
|
||||||
name='Product unit', unit='u')
|
name='Product unit', unit='u')
|
||||||
product2 = self.prep_asset_product(
|
product2 = self.prep_asset_product(
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.tests.test_tryton import with_transaction
|
from trytond.tests.test_tryton import with_transaction
|
||||||
|
from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
@ -19,6 +20,7 @@ class RateTestCase(object):
|
||||||
Asset = Pool().get('investment.asset')
|
Asset = Pool().get('investment.asset')
|
||||||
|
|
||||||
company = self.prep_asset_company()
|
company = self.prep_asset_company()
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
|
|
@ -36,6 +36,7 @@ class SourceTestCase(object):
|
||||||
}])
|
}])
|
||||||
self.assertEqual(osource.rec_name, 'Source 1')
|
self.assertEqual(osource.rec_name, 'Source 1')
|
||||||
|
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
product = self.prep_asset_product(
|
product = self.prep_asset_product(
|
||||||
name='Product 1',
|
name='Product 1',
|
||||||
description='some asset')
|
description='some asset')
|
||||||
|
|
Loading…
Reference in a new issue