2
.. i18n: OpenERP Objects
3
.. i18n: ===============
10
.. i18n: ----------------
16
.. i18n: .. This chapter is dedicated to detailed objects definition:
19
.. i18n: inheritancies
22
.. This chapter is dedicated to detailed objects definition:
27
.. i18n: All the ERP's pieces of data are accessible through "objects". As an example, there is a res.partner object to access the data concerning the partners, an account.invoice object for the data concerning the invoices, etc...
30
All the ERP's pieces of data are accessible through "objects". As an example, there is a res.partner object to access the data concerning the partners, an account.invoice object for the data concerning the invoices, etc...
32
.. i18n: Please note that there is an object for every type of resource, and not an
33
.. i18n: object per resource. We have thus a res.partner object to manage all the
34
.. i18n: partners and not a *res.partner* object per partner. If we talk in "object
35
.. i18n: oriented" terms, we could also say that there is an object per level.
38
Please note that there is an object for every type of resource, and not an
39
object per resource. We have thus a res.partner object to manage all the
40
partners and not a *res.partner* object per partner. If we talk in "object
41
oriented" terms, we could also say that there is an object per level.
43
.. i18n: The direct consequences is that all the methods of objects have a common parameter: the "ids" parameter. This specifies on which resources (for example, on which partner) the method must be applied. Precisely, this parameter contains a list of resource ids on which the method must be applied.
46
The direct consequences is that all the methods of objects have a common parameter: the "ids" parameter. This specifies on which resources (for example, on which partner) the method must be applied. Precisely, this parameter contains a list of resource ids on which the method must be applied.
48
.. i18n: For example, if we have two partners with the identifiers 1 and 5, and we want to call the res_partner method "send_email", we will write something like::
50
.. i18n: res_partner.send_email(... , [1, 5], ...)
53
For example, if we have two partners with the identifiers 1 and 5, and we want to call the res_partner method "send_email", we will write something like::
55
res_partner.send_email(... , [1, 5], ...)
57
.. i18n: We will see the exact syntax of object method calls further in this document.
60
We will see the exact syntax of object method calls further in this document.
62
.. i18n: In the following section, we will see how to define a new object. Then, we will check out the different methods of doing this.
65
In the following section, we will see how to define a new object. Then, we will check out the different methods of doing this.
67
.. i18n: For developers:
72
.. i18n: * OpenERP "objects" are usually called classes in object oriented programming.
73
.. i18n: * A OpenERP "resource" is usually called an object in OO programming, instance of a class.
76
* OpenERP "objects" are usually called classes in object oriented programming.
77
* A OpenERP "resource" is usually called an object in OO programming, instance of a class.
79
.. i18n: It's a bit confusing when you try to program inside OpenERP, because the language used is Python, and Python is a fully object oriented language, and has objects and instances ...
82
It's a bit confusing when you try to program inside OpenERP, because the language used is Python, and Python is a fully object oriented language, and has objects and instances ...
84
.. i18n: Luckily, an OpenERP "resource" can be converted magically into a nice Python object using the "browse" class method (OpenERP object method).
87
Luckily, an OpenERP "resource" can be converted magically into a nice Python object using the "browse" class method (OpenERP object method).