Check rule only if _check_access is set and enforce companies rule

issue4080
review343891009
This commit is contained in:
Cédric Krier
2021-04-10 23:46:24 +02:00
parent 66bd73bf59
commit 5172f2dcd4
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -53,16 +53,16 @@ this repository contains the full copyright notices and license terms. -->
<field name="action" ref="act_promotion_relate"/>
</record>
<record model="ir.rule.group" id="rule_group_promotion">
<field name="name">User in company</field>
<record model="ir.rule.group" id="rule_group_promotion_companies">
<field name="name">User in companies</field>
<field name="model" search="[('model', '=', 'sale.promotion')]"/>
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_promotion1">
<record model="ir.rule" id="rule_promotion_companies">
<field name="domain"
eval="[('company', '=', Eval('user', {}).get('company', None))]"
eval="[('company', 'in', Eval('companies', []))]"
pyson="1"/>
<field name="rule_group" ref="rule_group_promotion"/>
<field name="rule_group" ref="rule_group_promotion_companies"/>
</record>
<record model="ir.model.access" id="access_promotion">
+2 -2
View File
@@ -7,10 +7,10 @@ from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import doctest_teardown
from trytond.tests.test_tryton import doctest_checker
from trytond.modules.company.tests import CompanyMultiValueTestMixin
from trytond.modules.company.tests import CompanyTestMixin
class SalePromotionTestCase(CompanyMultiValueTestMixin, ModuleTestCase):
class SalePromotionTestCase(CompanyTestMixin, ModuleTestCase):
'Test Sale Promotion module'
module = 'sale_promotion'