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