~xrg/openobject-doc/trunk-xrg

« back to all changes in this revision

Viewing changes to i18n/vi/source/developer/2_5_Objects_Fields_Methods/object_attributes.rst

  • Committer: TruongSinh Tran
  • Date: 2009-07-17 18:59:45 UTC
  • Revision ID: truongsinh@vipescoserver-20090717185945-ajjp3zso6xh5jddm
[FIX]private issue

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
.. i18n: OpenERP Object Attributes
 
3
.. i18n: =========================
 
4
 
 
5
OpenERP Object Attributes
 
6
=========================
 
7
 
 
8
.. i18n: Objects Introduction
 
9
.. i18n: --------------------
 
10
 
 
11
Objects Introduction
 
12
--------------------
 
13
 
 
14
.. i18n: To define a new object, you have to define a new Python class then instantiate it. This class must inherit from the osv class in the osv module.
 
15
 
 
16
To define a new object, you have to define a new Python class then instantiate it. This class must inherit from the osv class in the osv module.
 
17
 
 
18
.. i18n: Object definition
 
19
.. i18n: -----------------
 
20
 
 
21
Object definition
 
22
-----------------
 
23
 
 
24
.. i18n: The first line of the object definition will always be of the form::
 
25
.. i18n: 
 
26
.. i18n:         class name_of_the_object(osv.osv):
 
27
.. i18n:                 _name = 'name.of.the.object'
 
28
.. i18n:                 _columns = { ... }
 
29
.. i18n:                 ...
 
30
.. i18n:         name_of_the_object()
 
31
 
 
32
The first line of the object definition will always be of the form::
 
33
 
 
34
        class name_of_the_object(osv.osv):
 
35
                _name = 'name.of.the.object'
 
36
                _columns = { ... }
 
37
                ...
 
38
        name_of_the_object()
 
39
 
 
40
.. i18n: An object is defined by declaring some fields with predefined names in the class. Two of them are required (_name and _columns), the rest is optional. The predefined fields are:
 
41
 
 
42
An object is defined by declaring some fields with predefined names in the class. Two of them are required (_name and _columns), the rest is optional. The predefined fields are:
 
43
 
 
44
.. i18n: Prefined names
 
45
.. i18n: ---------------
 
46
 
 
47
Prefined names
 
48
---------------
 
49
 
 
50
.. i18n: :_auto:
 
51
 
 
52
:_auto:
 
53
 
 
54
.. i18n: Determines whether a corresponding PostgreSQL table must be generated automatically from the object. Setting _auto to False can be useful in case of Open ERP objects generated from PostgreSQL views. See the "Reporting From PostgreSQL Views" section for more details.
 
55
 
 
56
Determines whether a corresponding PostgreSQL table must be generated automatically from the object. Setting _auto to False can be useful in case of Open ERP objects generated from PostgreSQL views. See the "Reporting From PostgreSQL Views" section for more details.
 
57
 
 
58
.. i18n: :_columns (required):
 
59
 
 
60
:_columns (required):
 
61
 
 
62
.. i18n: The object fields. See the fields section for details.
 
63
 
 
64
The object fields. See the fields section for details.
 
65
 
 
66
.. i18n: :_constraints:
 
67
 
 
68
:_constraints:
 
69
 
 
70
.. i18n: The constraints on the object. See the constraints section for details.
 
71
 
 
72
The constraints on the object. See the constraints section for details.
 
73
 
 
74
.. i18n: :_sql_constraints:
 
75
 
 
76
:_sql_constraints:
 
77
 
 
78
.. i18n: The SQL Constraint on the object. See theconstraints SQL section for more details.
 
79
 
 
80
The SQL Constraint on the object. See theconstraints SQL section for more details.
 
81
 
 
82
.. i18n: :_defaults:
 
83
 
 
84
:_defaults:
 
85
 
 
86
.. i18n: The default values for some of the object's fields. See the default value section for details.
 
87
 
 
88
The default values for some of the object's fields. See the default value section for details.
 
89
 
 
90
.. i18n: :_inherit:
 
91
 
 
92
:_inherit:
 
93
 
 
94
.. i18n: The name of the osv object which the current object inherits from. See the object inheritance section (first form) for details.
 
95
 
 
96
The name of the osv object which the current object inherits from. See the object inheritance section (first form) for details.
 
97
 
 
98
.. i18n: :_inherits:
 
99
 
 
100
:_inherits:
 
101
 
 
102
.. i18n: The list of osv objects the object inherits from. This list must be given in a python dictionary of the form: {'name_of_the_parent_object': 'name_of_the_field', ...}. See the object inheritance section (second form) for details. Default value: {}.
 
103
 
 
104
The list of osv objects the object inherits from. This list must be given in a python dictionary of the form: {'name_of_the_parent_object': 'name_of_the_field', ...}. See the object inheritance section (second form) for details. Default value: {}.
 
105
 
 
106
.. i18n: :_log_access:
 
107
 
 
108
:_log_access:
 
109
 
 
110
.. i18n: Determines whether or not the write access to the resource must be logged. If true, four fields will be created in the SQL table: create_uid, create_date, write_uid, write_date. Those fields represent respectively the id of the user who created the record, the creation date of record, the id of the user who last modified the record, and the date of that last modification. This data may be obtained by using the perm_read method.
 
111
 
 
112
Determines whether or not the write access to the resource must be logged. If true, four fields will be created in the SQL table: create_uid, create_date, write_uid, write_date. Those fields represent respectively the id of the user who created the record, the creation date of record, the id of the user who last modified the record, and the date of that last modification. This data may be obtained by using the perm_read method.
 
113
 
 
114
.. i18n: :_name (required):
 
115
 
 
116
:_name (required):
 
117
 
 
118
.. i18n: Name of the object. Default value: None.
 
119
 
 
120
Name of the object. Default value: None.
 
121
 
 
122
.. i18n: :_order:
 
123
 
 
124
:_order:
 
125
 
 
126
.. i18n: Name of the fields used to sort the results of the search and read methods.
 
127
 
 
128
Name of the fields used to sort the results of the search and read methods.
 
129
 
 
130
.. i18n: Default value: 'id'.
 
131
 
 
132
Default value: 'id'.
 
133
 
 
134
.. i18n:     Examples::
 
135
.. i18n: 
 
136
.. i18n:                 _order = "name"  
 
137
.. i18n:                 _order = "date_order desc"
 
138
 
 
139
    Examples::
 
140
 
 
141
                _order = "name"  
 
142
                _order = "date_order desc"
 
143
 
 
144
.. i18n: :_rec_name:
 
145
 
 
146
:_rec_name:
 
147
 
 
148
.. i18n: Name of the field in which the name of every resource is stored. Default value: 'name'. Note: by default, the name_get method simply returns the content of this field.
 
149
 
 
150
Name of the field in which the name of every resource is stored. Default value: 'name'. Note: by default, the name_get method simply returns the content of this field.
 
151
 
 
152
.. i18n: :_sequence:
 
153
 
 
154
:_sequence:
 
155
 
 
156
.. i18n: Name of the SQL sequence that manages the ids for this object. Default value: None.
 
157
 
 
158
Name of the SQL sequence that manages the ids for this object. Default value: None.
 
159
 
 
160
.. i18n: :_sql:
 
161
 
 
162
:_sql:
 
163
 
 
164
.. i18n: SQL code executed upon creation of the object (only if _auto is True)
 
165
 
 
166
SQL code executed upon creation of the object (only if _auto is True)
 
167
 
 
168
.. i18n: :_table:
 
169
 
 
170
:_table:
 
171
 
 
172
.. i18n: Name of the SQL table. Default value: the value of the _name field above with the dots ( . ) replaced by underscores ( _ ). 
 
173
 
 
174
Name of the SQL table. Default value: the value of the _name field above with the dots ( . ) replaced by underscores ( _ ).