Creating a basic module
In Odoo, tasks are performed by creating modules.
Modules customize the behavior of an Odoo installation, either by adding new behaviors or by altering existing ones (including behaviors added by other modules).
Odoo's scaffoldingcan setup a basic module. To quickly get started simply invoke:
$ ./odoo-bin scaffold Academy my-modules
This will automatically create amy-modules
_module directory_with anacademy
module inside. The directory can be an existing module directory if you want, but the module name must be unique within the directory.
A demonstration module
We have a "complete" module ready for installation.
Although it does absolutely nothing we can install it:
- start the Odoo server
$ ./odoo-bin --addons-path addons,my-modules
go to http://localhost:8069
create a new database including demonstration data
click the Install button for the _Academy _module
to go Settings ‣ Modules ‣ Modules
in the top-right corner remove the Installed _filter and search for _academy
To the browser
Controllersinterpret browser requests and send data back.
Add a simple controller and ensure it is imported by__init__.py
(so Odoo can find it):
academy/controllers.py
# -*- coding: utf-8 -*-
from odoo import http
class Academy(http.Controller):
@http.route('/academy/academy/', auth='public')
def index(self, **kw):
return "Hello, world"
# @http.route('/academy/academy/objects/', auth='public')
# def list(self, **kw):
Shut down your server (^C
) then restart it:
$ ./odoo-bin --addons-path addons,my-modules
and open a page to http://localhost:8069/academy/academy/ , you should see your "page" appear: "Hello world"