Files
tryton/trytond/tests/access.py
T
Cédric Krier 2563aed9b0 Check read access on parent field of child/parent operators
The 4th element of the clause is the parent field for the child_of/parent_of
operators, so it must be used to check access as related field.
Also we must remove the 4th element when checking related domain.

issue11115
review391371002
2022-01-11 23:07:45 +01:00

44 lines
1.2 KiB
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, fields
from trytond.pool import Pool
class TestAccess(ModelSQL):
'Test Access'
__name__ = 'test.access'
field1 = fields.Char('Field 1')
field2 = fields.Char('Field 2')
relate = fields.Many2One('test.access.relate', "Relate")
reference = fields.Reference("Reference", [
(None, ""),
('test.access.relate', "Reference"),
])
dict_ = fields.Dict(None, "Dict")
class TestAccessRelate(ModelSQL):
"Test Access"
__name__ = 'test.access.relate'
value = fields.Integer("Value")
parent = fields.Many2One('test.access.relate', "Parent")
class TestAccessModel(TestAccess):
"Test Access from Model"
__name__ = 'test.access.model'
access = fields.Many2One('test.access', "Access")
@classmethod
def __setup__(cls):
super().__setup__()
cls.__access__.add('access')
def register(module):
Pool.register(
TestAccess,
TestAccessRelate,
TestAccessModel,
module=module, type_='model')