Starting With Odoo
Start/Stop the Odoo server
Odoo uses a client/server architecture in which clients are web browsers accessing the Odoo server via RPC.
In order to start the server, simply invoke the command odoo.py in the shell, adding the full path to the file if necessary:
odoo.py /openerp-server
Updating a Module
openerp-server -u module_name(all/base) -d database_name --xmlrpc-port=port_no
The server is stopped by hitting Ctrl-C twice from the terminal, or by killing the corresponding OS process.
Installing A Module :
openerp-server -i module_name(all/base) -d database_name
Odoo In the Browser:
localhost :8069
localhost :8069/web/login
localhost :8069/web/database/manager
localhost :8069/web/database/selector
Build an Odoo module
Everything in Odoo thus starts and ends with modules.
Odoo modules can either add brand new business logic to an Odoo system, or alter and extend existing business logic.
Creating A New Module
Odoo provides a mechanism to help set up a new module, odoo.py has a subcommand scaffold to create an empty module:
$ odoo.py scaffold <module name> <where to put it>
The command creates a subdirectory for your module, and automatically creates a bunch of standard files for a module. Most of them simply contain commented code or XML. Eg:
odoo.py scaffold openacademy addons
Create a module openacademy in the folder addons in pwd .
Composition of a module
An Odoo module can contain a number of elements:
Business objects
Declared as Python classes, these resources are automatically persisted byOdoo based on their configuration
Data files
XML or CSV files declaring metadata (views or workflows), configuration data (modules parameterization), demonstration data and more
Web controllers
Handle requests from web browsers
Static web data
Images, CSS or javascript files used by the web interface or website
Module structure
Each module is a directory within a addon directory.
addons/
module_name/
security/
ir.model.access.csv
__init__.py : Indiacate that a module is a Python package with import instructions for various Python files in the module. from . import mymodule
__openerp__.py :An Odoo module is declared by its manifest. Module configuration
controllers.py
demo.xml
models.py
temlates.xml
views.xml
Models can be configured by setting a number of attributes at their definition. The most important attribute is
Odoo uses a client/server architecture in which clients are web browsers accessing the Odoo server via RPC.
In order to start the server, simply invoke the command odoo.py in the shell, adding the full path to the file if necessary:
odoo.py /openerp-server
odoo.py --addons-path= / / /addons,/ / / / /openerp/addons
Or
openerp-server --addons-path= / / /addons,/ / / / /openerp/addons
Updating a Module
openerp-server -u module_name(all/base) -d database_name --xmlrpc-port=port_no
The server is stopped by hitting Ctrl-C twice from the terminal, or by killing the corresponding OS process.
Installing A Module :
openerp-server -i module_name(all/base) -d database_name
Odoo In the Browser:
localhost :8069
localhost :8069/web/login
localhost :8069/web/database/manager
localhost :8069/web/database/selector
Build an Odoo module
Everything in Odoo thus starts and ends with modules.
Odoo modules can either add brand new business logic to an Odoo system, or alter and extend existing business logic.
Creating A New Module
Odoo provides a mechanism to help set up a new module, odoo.py has a subcommand scaffold to create an empty module:
$ odoo.py scaffold <module name> <where to put it>
The command creates a subdirectory for your module, and automatically creates a bunch of standard files for a module. Most of them simply contain commented code or XML. Eg:
odoo.py scaffold openacademy addons
Create a module openacademy in the folder addons in pwd .
Composition of a module
An Odoo module can contain a number of elements:
Business objects
Declared as Python classes, these resources are automatically persisted byOdoo based on their configuration
Data files
XML or CSV files declaring metadata (views or workflows), configuration data (modules parameterization), demonstration data and more
Web controllers
Handle requests from web browsers
Static web data
Images, CSS or javascript files used by the web interface or website
Module structure
Each module is a directory within a addon directory.
addons/
module_name/
security/
ir.model.access.csv
__init__.py : Indiacate that a module is a Python package with import instructions for various Python files in the module. from . import mymodule
__openerp__.py :An Odoo module is declared by its manifest. Module configuration
controllers.py
demo.xml
models.py
temlates.xml
views.xml
odoo.py scaffold openacademy addonsopenacademy/__openerp__.pyopenacademy/__init__.pyopenacademy/controllers.pyopenacademy/demo.xmlopenacademy/models.pyopenacademy/security/ir.model.access.csvopenacademy/templates.xmlObject-Relational Mapping
A key component of Odoo is the ORM layer. This layer avoids having to write most SQL by hand and provides extensibility and security services .Model
Business objects are declared as Python classes extendingModel which integrates them into the automated
persistence system.Models can be configured by setting a number of attributes at their definition. The most important attribute is
_name which is required and defines the name for
the model in the Odoo system.from openerp import models
class MinimalModel(models.Model):
_name = 'test.model'
Model fields
Fields are used to define what the model can store and where. Fields are defined as attributes on the model class:from openerp import models, fields
class LessMinimalModel(models.Model):
_name = 'test.model2'
name = fields.Char()
Common Attributes
Some attributes are available on all fields, here are the most common ones:string(unicode, default: field's name)- The label of the field in UI (visible by users).
required(bool, default:False)- If
True, the field can not be empty, it must either have a default value or always be given a value when creating a record. help(unicode, default:'')- Long-form, provides a help tooltip to users in the UI.
index(bool, default:False)- Requests that Odoo create a database index on the column
0 comments:
Post a Comment