changeset 1949f901874d in modules/web_shop:default
details: https://hg.tryton.org/modules/web_shop?cmd=changeset&node=1949f901874d
description:
        Check rule only if _check_access is set and enforce companies rule

        issue4080
        review343891009
diffstat:

 tests/test_web_shop.py |   4 ++--
 web.xml                |  12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 345598557263 -r 1949f901874d tests/test_web_shop.py
--- a/tests/test_web_shop.py    Sat Apr 03 14:27:10 2021 +0200
+++ b/tests/test_web_shop.py    Sat Apr 10 23:46:24 2021 +0200
@@ -7,10 +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
+from trytond.modules.company.tests import CompanyTestMixin
 
 
-class WebShopTestCase(CompanyMultiValueTestMixin, ModuleTestCase):
+class WebShopTestCase(CompanyTestMixin, ModuleTestCase):
     'Test Web Shop module'
     module = 'web_shop'
     extras = ['product_attribute']
diff -r 345598557263 -r 1949f901874d web.xml
--- a/web.xml   Sat Apr 03 14:27:10 2021 +0200
+++ b/web.xml   Sat Apr 10 23:46:24 2021 +0200
@@ -36,6 +36,18 @@
             sequence="20"
             id="menu_shop"/>
 
+        <record model="ir.rule.group" id="rule_group_shop_companies">
+            <field name="name">User in companies</field>
+            <field name="model" search="[('model', '=', 'web.shop')]"/>
+            <field name="global_p" eval="True"/>
+        </record>
+        <record model="ir.rule" id="rule_shop_companies">
+            <field name="domain"
+                eval="[('company', 'in', Eval('companies', []))]"
+                pyson="1"/>
+            <field name="rule_group" ref="rule_group_shop_companies"/>
+        </record>
+
         <record model="ir.model.access" id="access_shop">
             <field name="model"
                 search="[('model', '=', 'web.shop')]"/>

Reply via email to