1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml">
6
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
<title>OpenERP Objects — 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 = {
15
COLLAPSE_MODINDEX: false,
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" />
31
<li class="right" style="margin-right: 10px">
32
<a href="../genindex.html" title="General Index"
33
accesskey="I">index</a></li>
35
<a href="orm.html" title="The ORM - Object Relation Model"
36
accesskey="N">next</a> |</li>
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> »</li>
41
<li><a href="index.html" accesskey="U">Objects, Fields and Methods</a> »</li>
45
<div class="document">
46
<div class="documentwrapper">
47
<div class="bodywrapper">
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’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...</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 @@res.partner@@ object per partner. If we talk in “object oriented” 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 “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.</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 “send_email”, 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>
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>
65
<li>Open ERP “objects” are usually called classes in object oriented programming.</li>
66
<li>A Open ERP “resource” is usually called an object in OO programming, instance of a class.</li>
68
<p>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 ...</p>
69
<p>Luckily, an Open ERP “resource” can be converted magically into a nice Python object using the “browse” class method (Open ERP object method).</p>
77
<div class="sphinxsidebar">
78
<div class="sphinxsidebarwrapper">
79
<h3><a href="../index.html">Table Of Contents</a></h3>
81
<li><a class="reference external" href="">OpenERP Objects</a><ul>
82
<li><a class="reference external" href="#introduction">Introduction</a></li>
87
<h4>Previous topic</h4>
88
<p class="topless"><a href="index.html"
89
title="previous chapter">Objects, Fields and Methods</a></p>
91
<p class="topless"><a href="orm.html"
92
title="next chapter">The ORM - Object Relation Model</a></p>
94
<ul class="this-page-menu">
95
<li><a href="../_sources/part_4/objects.txt"
96
rel="nofollow">Show Source</a></li>
98
<div id="searchbox" style="display: none">
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" />
106
<p class="searchtip" style="font-size: 90%">
107
Enter search terms or a module, class or function name.
110
<script type="text/javascript">$('#searchbox').show(0);</script>
113
<div class="clearer"></div>
115
<div class="related">
118
<li class="right" style="margin-right: 10px">
119
<a href="../genindex.html" title="General Index"
122
<a href="orm.html" title="The ORM - Object Relation Model"
125
<a href="index.html" title="Objects, Fields and Methods"
127
<li><a href="../index.html">openerp v1 documentation</a> »</li>
128
<li><a href="index.html" >Objects, Fields and Methods</a> »</li>
132
© Copyright 2009, openerp.
133
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
b'\\ No newline at end of file'