changeset 95b277884187 in modules/stock_supply:default
details:
https://hg.tryton.org/modules/stock_supply?cmd=changeset&node=95b277884187
description:
Check rule only if _check_access is set and enforce companies rule
issue4080
review343891009
diffstat:
order_point.py | 5 ++++-
order_point.xml | 10 +++++-----
tests/test_stock_supply.py | 5 +++--
3 files changed, 12 insertions(+), 8 deletions(-)
diffs (62 lines):
diff -r 19e518a5d442 -r 95b277884187 order_point.py
--- a/order_point.py Mon Apr 05 15:15:39 2021 +0200
+++ b/order_point.py Sat Apr 10 23:46:24 2021 +0200
@@ -27,7 +27,10 @@
('purchasable', 'in', If(Equal(Eval('type'), 'purchase'),
[True], [True, False])),
],
- depends=['type'])
+ context={
+ 'company': Eval('company', -1),
+ },
+ depends=['type', 'company'])
warehouse_location = fields.Many2One('stock.location',
'Warehouse Location', select=True,
domain=[('type', '=', 'warehouse')],
diff -r 19e518a5d442 -r 95b277884187 order_point.xml
--- a/order_point.xml Mon Apr 05 15:15:39 2021 +0200
+++ b/order_point.xml Sat Apr 10 23:46:24 2021 +0200
@@ -70,16 +70,16 @@
<field name="perm_delete" eval="True"/>
</record>
- <record model="ir.rule.group" id="rule_group_order_point">
- <field name="name">User in company</field>
+ <record model="ir.rule.group" id="rule_group_order_point_companies">
+ <field name="name">User in companies</field>
<field name="model" search="[('model', '=',
'stock.order_point')]"/>
<field name="global_p" eval="True"/>
</record>
- <record model="ir.rule" id="rule_order_point">
+ <record model="ir.rule" id="rule_order_point_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_order_point"/>
+ <field name="rule_group" ref="rule_group_order_point_companies"/>
</record>
</data>
</tryton>
diff -r 19e518a5d442 -r 95b277884187 tests/test_stock_supply.py
--- a/tests/test_stock_supply.py Mon Apr 05 15:15:39 2021 +0200
+++ b/tests/test_stock_supply.py Sat Apr 10 23:46:24 2021 +0200
@@ -10,7 +10,8 @@
from trytond.tests.test_tryton import doctest_checker
from trytond.pool import Pool
-from trytond.modules.company.tests import create_company, set_company
+from trytond.modules.company.tests import (
+ create_company, set_company, CompanyTestMixin)
from trytond.modules.account.tests import create_chart
DATES = [
@@ -32,7 +33,7 @@
]
-class StockSupplyTestCase(ModuleTestCase):
+class StockSupplyTestCase(CompanyTestMixin, ModuleTestCase):
'Test StockSupply module'
module = 'stock_supply'