File: export_data.py

package info (click to toggle)
tryton-server 7.0.40-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,748 kB
  • sloc: python: 53,502; xml: 5,194; sh: 803; sql: 217; makefile: 28
file content (68 lines) | stat: -rw-r--r-- 2,212 bytes parent folder | download
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
# This file is part of Tryton.  The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"Test for export_data"
from trytond.model import ModelSQL, fields
from trytond.pool import Pool, PoolMeta


class ExportDataTarget(ModelSQL):
    "Export Data Target"
    __name__ = 'test.export_data.target'
    name = fields.Char('Name')
    value = fields.Float("Value")


class ExportData(ModelSQL):
    "Export Data"
    __name__ = 'test.export_data'
    boolean = fields.Boolean('Boolean')
    integer = fields.Integer('Integer')
    float = fields.Float('Float')
    numeric = fields.Numeric('Numeric')
    char = fields.Char('Char')
    text = fields.Text('Text')
    date = fields.Date('Date')
    datetime = fields.DateTime('DateTime')
    timedelta = fields.TimeDelta('TimeDelta')
    selection = fields.Selection([
            (None, ''),
            ('select1', 'Select 1'),
            ('select2', 'Select 2'),
            ], 'Selection')
    multiselection = fields.MultiSelection([
            ('select1', "Select 1"),
            ('select2', "Select 2"),
            ('select3', "Select 3"),
            ], "MultiSelection")
    many2one = fields.Many2One('test.export_data.target',
            'Many2One')
    many2many = fields.Many2Many('test.export_data.relation',
            'many2many', 'target', 'Many2Many')
    one2many = fields.One2Many('test.export_data.target', 'one2many',
            'One2Many')
    reference = fields.Reference('Reference', [
            (None, ''),
            ('test.export_data.target', 'Target'),
            ])


class ExportDataTarget2(metaclass=PoolMeta):
    'Export Date Target'
    __name__ = 'test.export_data.target'
    one2many = fields.Many2One('test.export_data', 'Export Data')


class ExportDataRelation(ModelSQL):
    "Export Data Many2Many"
    __name__ = 'test.export_data.relation'
    many2many = fields.Many2One('test.export_data', 'Export Data')
    target = fields.Many2One('test.export_data.target', 'Target')


def register(module):
    Pool.register(
        ExportDataTarget,
        ExportData,
        ExportDataTarget2,
        ExportDataRelation,
        module=module, type_='model')