diff --git a/tests/test_web_shop.py b/tests/test_web_shop.py index b56f655fbf..1554282eab 100644 --- a/tests/test_web_shop.py +++ b/tests/test_web_shop.py @@ -7,8 +7,10 @@ import unittest from trytond.tests.test_tryton import ModuleTestCase from trytond.tests.test_tryton import suite as test_suite +from trytond.modules.company.tests import CompanyMultiValueTestMixin -class WebShopTestCase(ModuleTestCase): + +class WebShopTestCase(CompanyMultiValueTestMixin, ModuleTestCase): 'Test Web Shop module' module = 'web_shop' extras = ['product_attribute'] diff --git a/web.py b/web.py index 545ee0bc42..7bd9b70e65 100644 --- a/web.py +++ b/web.py @@ -64,23 +64,44 @@ class Shop(DeactivableMixin, ModelSQL, ModelView): domain=[ ('type', '=', 'warehouse'), ]) - guest_party = fields.Many2One('party.party', "Guest Party") + guest_party = fields.Many2One( + 'party.party', "Guest Party", + context={ + 'company': Eval('company', -1), + }, + depends=['company']) products = fields.Many2Many( 'web.shop-product.product', 'shop', 'product', "Products", domain=[ ('salable', '=', True), ], + context={ + 'company': Eval('company', -1), + }, + depends=['company'], help="The list of products to publish.") products_removed = Many2ManyInactive( 'web.shop-product.product', 'shop', 'product', "Products Removed", + context={ + 'company': Eval('company', -1), + }, + depends=['company'], help="The list of products to unpublish.") categories = fields.Many2Many( 'web.shop-product.category', 'shop', 'category', "Categories", + context={ + 'company': Eval('company', -1), + }, + depends=['company'], help="The list of categories to publish.") categories_removed = Many2ManyInactive( 'web.shop-product.category', 'shop', 'category', "Categories Removed", + context={ + 'company': Eval('company', -1), + }, + depends=['company'], help="The list of categories to unpublish.") _name_cache = Cache('web.shop.name', context=False)