Le fichier __init__.py sert à l'initialisation du module car c'est le fichier qui va inviter Odoo à charger le module. Il contient le code suivant :
# -*- coding: utf-8 -*- from . import controllers from . import models
Vous pouvez visualiser le contenu des autres fichiers générés :
# -*- coding: utf-8 -*- from openerp import http # class Openacademy(http.Controller): # @http.route('/openacademy/openacademy/', auth='public') # def index(self, **kw): # return "Hello, world" # @http.route('/openacademy/openacademy/objects/', auth='public') # def list(self, **kw): # return http.request.render('openacademy.listing', { # 'root': '/openacademy/openacademy', # 'objects': http.request.env['openacademy.openacademy'].search([]), # }) # @http.route('/openacademy/openacademy/objects/<model("openacademy.openacademy"):obj>/', auth='public') # def object(self, obj, **kw): # return http.request.render('openacademy.object', { # 'object': obj # })
<openerp> <data> <!-- --> <!-- <record id="object0" model="openacademy.openacademy"> --> <!-- <field name="name">Object 0</field> --> <!-- </record> --> <!-- --> <!-- <record id="object1" model="openacademy.openacademy"> --> <!-- <field name="name">Object 1</field> --> <!-- </record> --> <!-- --> <!-- <record id="object2" model="openacademy.openacademy"> --> <!-- <field name="name">Object 2</field> --> <!-- </record> --> <!-- --> <!-- <record id="object3" model="openacademy.openacademy"> --> <!-- <field name="name">Object 3</field> --> <!-- </record> --> <!-- --> <!-- <record id="object4" model="openacademy.openacademy"> --> <!-- <field name="name">Object 4</field> --> <!-- </record> --> <!-- --> </data> </openerp>
# -*- coding: utf-8 -*- from openerp import models, fields, api # class openacademy(models.Model): # _name = 'openacademy.openacademy' # name = fields.Char()
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink access_openacademy_openacademy,openacademy.openacademy,model_openacademy_openacademy,,1,0,0,0
<openerp> <data> <!-- <template id="listing"> --> <!-- <ul> --> <!-- <li t-foreach="objects" t-as="object"> --> <!-- <a t-attf-href="{{ root }}/objects/{{ object.id }}"> --> <!-- <t t-esc="object.display_name"/> --> <!-- </a> --> <!-- </li> --> <!-- </ul> --> <!-- </template> --> <!-- <template id="object"> --> <!-- <h1><t t-esc="object.display_name"/></h1> --> <!-- <dl> --> <!-- <t t-foreach="object._fields" t-as="field"> --> <!-- <dt><t t-esc="field"/></dt> --> <!-- <dd><t t-esc="object[field]"/></dd> --> <!-- </t> --> <!-- </dl> --> <!-- </template> --> </data> </openerp>