Reputation: 583
I'm new to OpenERP and Python, I'm trying to understand the various functions in the py files. There is an import function used in all files generally devided into two parts : the first part seems to refer to Python librairies (called modules ?) like from datetime import datetime
or from dateutil.relativedelta import relativedelta
but the second part, I don't know what it refers to.
I would like to know what the following functions refer to :
import netsvc
import pooler
from osv import fields, osv
import decimal_precision as dp
from tools.translate import _
What is netsvc, pooler, osv, decimal_precision, tools_translate ? If they are openERP modules, where can I find the code behind them, else what are they ?
I would be grateful to anyone who would be able to explain to me all of them, and any other similar ones if he/she knows of any.
Upvotes: 1
Views: 3474
Reputation: 56720
It sounds like you have installed some version of OpenERP that includes compiled files instead of the raw Python source code.
I suggest you reconfigure your development environment by checking the source out from launchpad and running the server from the source code. Personally, I like to run it under Eclipse with PyDev, because it has a nice debugger.
For the project configuration in Eclipse, I just checked out each branch from launchpad, and then imported each one as a project into my Eclipse workspace. The launch details are a bit different between 6.0 and 6.1. Here are my command line arguments for launching each version of the server project:
6.0:
--addons-path ${workspace_loc:openerp-addons-6.0} --config ${workspace_loc:openerp-config/src/server.config} --xmlrpc-port=9069 --netrpc-port=9070 --xmlrpcs-port=9071
6.1 needs the web client to launch with the server:
--addons-path ${workspace_loc:openerp-addons-trunk},${workspace_loc:openerp-web-trunk}/addons,${workspace_loc:openerp-migration} --config ${workspace_loc:openerp-config/src/server.config} --xmlrpc-port=9069 --netrpc-port=9070 --xmlrpcs-port=9071
Upvotes: 1
Reputation: 14355
pooler
is a python module which keeps track of all the objects of your all modules those you've installed and its maintaining it per database.
netsvc
module is responsible for socket
services( default 8070 port to connect openerp )
decimal_precision
is module which takes care of floating point numbers where required like tax prices in invoice depends on your choice 2 decimal or 3 decimal etc... which also depends on the configuration you had provided, This module is responsible to keep the same configuration for all such objects ( to provide same decimal precision )
_
is a gettext.gettext
alias, to keep the information translated for all the languages you've installed for selected database.
Locations:
netsvc $Server_path/openerp/netsvc.py
pooler $Server_path/openerp/pooler.py
$server_path - is where you've installed your openerp server.
decision_precision
you can found inside openerp addons it a standard openerp module.
Upvotes: 2
Reputation: 2431
All of these are openerp python modules:
./server/6.1/openerp/netsvc.py
./server/6.1/openerp/pooler.py
./server/6.1/openerp/osv/osv.py
./server/6.1/openerp/tools
except for decimal_precision
that is an openerp module
and you can find it into the addons:
./addons/6.1/decimal_precision
All those import are relative import
that is a bad coding attitude (see the relative pep). Fortunately the openerp team is moving towards a better approach like from openerp.addons import this
.
Upvotes: 3
Reputation: 805
You can find the code in the $server/openerp/
all are relative path to the $server/openerp/
where "$server" is a path for your OpenERP Server
Upvotes: 2
Reputation: 251478
Those are Python modules. They are not part of the standard library but some third-party libraries you installed. They may be part of OpenERP, or part of some other library used by OpenERP. If you open the interactive interpreter, you can import the modules and then look at their __file__
attribute to see where the file is. For instance, for a random module called guineapyg
that I have installed:
>>> import guineapyg
>>> guineapyg.__file__
'C:\\Documents and Settings\\BrenBarn\\My Documents\\Python\\guineapyg\\guineapyg.py'
You should read the Python tutorial to familiarize yourself with importing modules and other basic Python stuff.
Upvotes: 2
Reputation: 799150
They're packages and modules, found somewhere within sys.path
.
Upvotes: 0