~openerp-vietnam/openobject-doc/technical-tutorial

« back to all changes in this revision

Viewing changes to build/html/_sources/part_4/objects.txt

  • Committer: Najlaâ EL KHAYAT
  • Date: 2009-04-07 12:47:35 UTC
  • Revision ID: nel@tinyerp.com-20090407124735-fvnl6acj42fhff34
doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
OpenERP Objects
 
2
===============
 
3
 
 
4
Introduction
 
5
----------------
 
6
 
 
7
.. This chapter is dedicated to detailed objects definition:
 
8
    all fields
 
9
    all objects
 
10
    inheritancies
 
11
 
 
12
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...
 
13
 
 
14
Please note that there is an object for every type of resource, and not an object per resource. We have thus a res.partner object to manage all the partners and not a @@res.partner@@ object per partner. If we talk in "object oriented" terms, we could also say that there is an object per level.
 
15
 
 
16
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.
 
17
 
 
18
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::
 
19
 
 
20
        res_partner.send_email(... , [1, 5], ...)
 
21
 
 
22
We will see the exact syntax of object method calls further in this document.
 
23
 
 
24
In the following section, we will see how to define a new object. Then, we will check out the different methods of doing this.
 
25
 
 
26
For developers:
 
27
 
 
28
* Open ERP "objects" are usually called classes in object oriented programming.
 
29
* A Open ERP "resource" is usually called an object in OO programming, instance of a class. 
 
30
 
 
31
It's a bit confusing when you try to program inside Open ERP, because the language used is Python, and Python is a fully object oriented language, and has objects and instances ...
 
32
 
 
33
Luckily, an Open ERP "resource" can be converted magically into a nice Python object using the "browse" class method (Open ERP object method). 
 
34
 
 
35