changeset 29ad0bfff95b in modules/web_shop:default
details: https://hg.tryton.org/modules/web_shop?cmd=changeset;node=29ad0bfff95b
description:
        Add test on context of company multivalue target fields

        issue10067
        review333851026
diffstat:

 tests/test_web_shop.py |   4 +++-
 web.py                 |  23 ++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diffs (64 lines):

diff -r df36136e0bab -r 29ad0bfff95b tests/test_web_shop.py
--- a/tests/test_web_shop.py    Sat Feb 27 18:16:29 2021 +0100
+++ b/tests/test_web_shop.py    Fri Mar 05 15:49:20 2021 +0100
@@ -7,8 +7,10 @@
 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 -r df36136e0bab -r 29ad0bfff95b web.py
--- a/web.py    Sat Feb 27 18:16:29 2021 +0100
+++ b/web.py    Fri Mar 05 15:49:20 2021 +0100
@@ -64,23 +64,44 @@
         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)

Reply via email to