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

        issue4080
        review343891009
diffstat:

 stock.xml                                   |  12 ++++++++++++
 tests/test_stock_quantity_early_planning.py |   4 +++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r 26706dae0e49 -r 309a3080eaab stock.xml
--- a/stock.xml Sun Mar 28 15:05:28 2021 +0200
+++ b/stock.xml Sat Apr 10 23:46:24 2021 +0200
@@ -72,6 +72,18 @@
             <field name="perm_delete" eval="True"/>
         </record>
 
+        <record model="ir.rule.group" 
id="rule_group_quantity_early_plan_companies">
+            <field name="name">User in companies</field>
+            <field name="model" search="[('model', '=', 
'stock.quantity.early_plan')]"/>
+            <field name="global_p" eval="True"/>
+        </record>
+        <record model="ir.rule" id="rule_quantity_early_plan_companies">
+            <field name="domain"
+                eval="[('company', 'in', Eval('companies', []))]"
+                pyson="1"/>
+            <field name="rule_group" 
ref="rule_group_quantity_early_plan_companies"/>
+        </record>
+
         <record model="ir.model.button" id="quantity_early_plan_open_button">
             <field name="name">open</field>
             <field name="string">Reset to Open</field>
diff -r 26706dae0e49 -r 309a3080eaab tests/test_stock_quantity_early_planning.py
--- a/tests/test_stock_quantity_early_planning.py       Sun Mar 28 15:05:28 
2021 +0200
+++ b/tests/test_stock_quantity_early_planning.py       Sat Apr 10 23:46:24 
2021 +0200
@@ -10,8 +10,10 @@
 from trytond.tests.test_tryton import doctest_teardown
 from trytond.tests.test_tryton import doctest_checker
 
+from trytond.modules.company.tests import CompanyTestMixin
 
-class StockQuantityEarlyPlanningTestCase(ModuleTestCase):
+
+class StockQuantityEarlyPlanningTestCase(CompanyTestMixin, ModuleTestCase):
     'Test Stock Quantity Early Planning module'
     module = 'stock_quantity_early_planning'
     extras = ['production']

Reply via email to