/usr/lib/python3/dist-packages/trytond/tests/modelview.py is in tryton-server 4.6.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | # 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 ModelView, fields
__all__ = [
'ModelViewChangedValues',
'ModelViewChangedValuesTarget',
'ModelViewButton',
'ModelViewRPC',
'ModelViewEmptyPage',
]
class ModelViewChangedValues(ModelView):
'ModelView Changed Values'
__name__ = 'test.modelview.changed_values'
name = fields.Char('Name')
target = fields.Many2One('test.modelview.changed_values.target', 'Target')
ref_target = fields.Reference('Target Reference', [
('test.modelview.changed_values.target', 'Target'),
])
targets = fields.One2Many('test.modelview.changed_values.target', 'model',
'Targets')
m2m_targets = fields.Many2Many('test.modelview.changed_values.target',
None, None, 'Targets')
class ModelViewChangedValuesTarget(ModelView):
'ModelView Changed Values Target'
__name__ = 'test.modelview.changed_values.target'
name = fields.Char('Name')
parent = fields.Many2One('test.modelview.changed_values', 'Parent')
class ModelViewButton(ModelView):
'ModelView Button'
__name__ = 'test.modelview.button'
value = fields.Integer("Value")
@classmethod
def __setup__(cls):
super(ModelViewButton, cls).__setup__()
cls._buttons = {
'test': {},
}
@classmethod
@ModelView.button
def test(cls, records):
cls.test_non_decorated(records)
@classmethod
def test_non_decorated(cls, records):
pass
class ModelViewRPC(ModelView):
'ModelView RPC'
__name__ = 'test.modelview.rpc'
selection = fields.Selection([('a', 'A')], 'Selection')
computed_selection = fields.Selection(
'get_selection', 'Computed Selection')
function_selection = fields.Function(
fields.Selection('get_function_selection', 'Function Selection'),
'function_selection_getter')
reference = fields.Reference('Reference', selection=[('a', 'A')])
computed_reference = fields.Reference(
'Computed reference', selection='get_reference')
function_reference = fields.Function(
fields.Reference('Function Reference',
selection='get_function_reference'),
'function_reference_getter')
integer = fields.Integer('Integer')
float = fields.Float('Float')
char = fields.Char('Char')
@fields.depends('selection')
def on_change_with_integer(self):
pass
@fields.depends('reference')
def on_change_float(self):
pass
@fields.depends('integer')
def autocomplete_char(self):
pass
@classmethod
def get_selection(cls):
pass
@classmethod
def get_function_selection(cls):
pass
@classmethod
def get_reference(cls):
pass
@classmethod
def get_function_reference(cls):
pass
class ModelViewEmptyPage(ModelView):
'ModelView Empty Page'
__name__ = 'test.modelview.empty_page'
|