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

« back to all changes in this revision

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

  • 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
<html xmlns="http://www.w3.org/1999/xhtml">
 
5
  <head>
 
6
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
7
    
 
8
    <title>OpenERP Objects &mdash; openerp v1 documentation</title>
 
9
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
 
10
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
11
    <script type="text/javascript">
 
12
      var DOCUMENTATION_OPTIONS = {
 
13
        URL_ROOT:    '../',
 
14
        VERSION:     '1',
 
15
        COLLAPSE_MODINDEX: false,
 
16
        FILE_SUFFIX: '.html',
 
17
        HAS_SOURCE:  true
 
18
      };
 
19
    </script>
 
20
    <script type="text/javascript" src="../_static/jquery.js"></script>
 
21
    <script type="text/javascript" src="../_static/doctools.js"></script>
 
22
    <link rel="top" title="openerp v1 documentation" href="../index.html" />
 
23
    <link rel="up" title="Objects, Fields and Methods" href="index.html" />
 
24
    <link rel="next" title="The ORM - Object Relation Model" href="orm.html" />
 
25
    <link rel="prev" title="Objects, Fields and Methods" href="index.html" /> 
 
26
  </head>
 
27
  <body>
 
28
    <div class="related">
 
29
      <h3>Navigation</h3>
 
30
      <ul>
 
31
        <li class="right" style="margin-right: 10px">
 
32
          <a href="../genindex.html" title="General Index"
 
33
             accesskey="I">index</a></li>
 
34
        <li class="right" >
 
35
          <a href="orm.html" title="The ORM - Object Relation Model"
 
36
             accesskey="N">next</a> |</li>
 
37
        <li class="right" >
 
38
          <a href="index.html" title="Objects, Fields and Methods"
 
39
             accesskey="P">previous</a> |</li>
 
40
        <li><a href="../index.html">openerp v1 documentation</a> &raquo;</li>
 
41
          <li><a href="index.html" accesskey="U">Objects, Fields and Methods</a> &raquo;</li> 
 
42
      </ul>
 
43
    </div>  
 
44
 
 
45
    <div class="document">
 
46
      <div class="documentwrapper">
 
47
        <div class="bodywrapper">
 
48
          <div class="body">
 
49
            
 
50
  <div class="section" id="openerp-objects">
 
51
<h1>OpenERP Objects<a class="headerlink" href="#openerp-objects" title="Permalink to this headline">¶</a></h1>
 
52
<div class="section" id="introduction">
 
53
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
 
54
<p>All the ERP&#8217;s pieces of data are accessible through &#8220;objects&#8221;. 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...</p>
 
55
<p>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 &#64;&#64;res.partner&#64;&#64; object per partner. If we talk in &#8220;object oriented&#8221; terms, we could also say that there is an object per level.</p>
 
56
<p>The direct consequences is that all the methods of objects have a common parameter: the &#8220;ids&#8221; 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.</p>
 
57
<p>For example, if we have two partners with the identifiers 1 and 5, and we want to call the res_partner method &#8220;send_email&#8221;, we will write something like:</p>
 
58
<div class="highlight-python"><div class="highlight"><pre><span class="n">res_partner</span><span class="o">.</span><span class="n">send_email</span><span class="p">(</span><span class="o">...</span> <span class="p">,</span> <span class="p">[</span><span class="mf">1</span><span class="p">,</span> <span class="mf">5</span><span class="p">],</span> <span class="o">...</span><span class="p">)</span>
 
59
</pre></div>
 
60
</div>
 
61
<p>We will see the exact syntax of object method calls further in this document.</p>
 
62
<p>In the following section, we will see how to define a new object. Then, we will check out the different methods of doing this.</p>
 
63
<p>For developers:</p>
 
64
<ul class="simple">
 
65
<li>Open ERP &#8220;objects&#8221; are usually called classes in object oriented programming.</li>
 
66
<li>A Open ERP &#8220;resource&#8221; is usually called an object in OO programming, instance of a class.</li>
 
67
</ul>
 
68
<p>It&#8217;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 ...</p>
 
69
<p>Luckily, an Open ERP &#8220;resource&#8221; can be converted magically into a nice Python object using the &#8220;browse&#8221; class method (Open ERP object method).</p>
 
70
</div>
 
71
</div>
 
72
 
 
73
 
 
74
          </div>
 
75
        </div>
 
76
      </div>
 
77
      <div class="sphinxsidebar">
 
78
        <div class="sphinxsidebarwrapper">
 
79
            <h3><a href="../index.html">Table Of Contents</a></h3>
 
80
            <ul>
 
81
<li><a class="reference external" href="">OpenERP Objects</a><ul>
 
82
<li><a class="reference external" href="#introduction">Introduction</a></li>
 
83
</ul>
 
84
</li>
 
85
</ul>
 
86
 
 
87
            <h4>Previous topic</h4>
 
88
            <p class="topless"><a href="index.html"
 
89
                                  title="previous chapter">Objects, Fields and Methods</a></p>
 
90
            <h4>Next topic</h4>
 
91
            <p class="topless"><a href="orm.html"
 
92
                                  title="next chapter">The ORM - Object Relation Model</a></p>
 
93
            <h3>This Page</h3>
 
94
            <ul class="this-page-menu">
 
95
              <li><a href="../_sources/part_4/objects.txt"
 
96
                     rel="nofollow">Show Source</a></li>
 
97
            </ul>
 
98
          <div id="searchbox" style="display: none">
 
99
            <h3>Quick search</h3>
 
100
              <form class="search" action="../search.html" method="get">
 
101
                <input type="text" name="q" size="18" />
 
102
                <input type="submit" value="Go" />
 
103
                <input type="hidden" name="check_keywords" value="yes" />
 
104
                <input type="hidden" name="area" value="default" />
 
105
              </form>
 
106
              <p class="searchtip" style="font-size: 90%">
 
107
              Enter search terms or a module, class or function name.
 
108
              </p>
 
109
          </div>
 
110
          <script type="text/javascript">$('#searchbox').show(0);</script>
 
111
        </div>
 
112
      </div>
 
113
      <div class="clearer"></div>
 
114
    </div>
 
115
    <div class="related">
 
116
      <h3>Navigation</h3>
 
117
      <ul>
 
118
        <li class="right" style="margin-right: 10px">
 
119
          <a href="../genindex.html" title="General Index"
 
120
             >index</a></li>
 
121
        <li class="right" >
 
122
          <a href="orm.html" title="The ORM - Object Relation Model"
 
123
             >next</a> |</li>
 
124
        <li class="right" >
 
125
          <a href="index.html" title="Objects, Fields and Methods"
 
126
             >previous</a> |</li>
 
127
        <li><a href="../index.html">openerp v1 documentation</a> &raquo;</li>
 
128
          <li><a href="index.html" >Objects, Fields and Methods</a> &raquo;</li> 
 
129
      </ul>
 
130
    </div>
 
131
    <div class="footer">
 
132
      &copy; Copyright 2009, openerp.
 
133
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
 
134
    </div>
 
135
  </body>
 
136
</html>
 
 
b'\\ No newline at end of file'