odoo/doc/howtos/backend/exercise-session

59 lines
2.3 KiB
Plaintext

# HG changeset patch
# Parent 22f8d180a7f9ad209d7e98cf7d1bd0fee1f05350
Index: addons/openacademy/models.py
===================================================================
--- addons.orig/openacademy/models.py 2014-08-27 10:35:29.179933749 +0200
+++ addons/openacademy/models.py 2014-08-27 10:35:56.000000000 +0200
@@ -7,3 +7,12 @@
name = fields.Char(string="Title", required=True)
description = fields.Text()
+
+
+class Session(models.Model):
+ _name = 'openacademy.session'
+
+ name = fields.Char(required=True)
+ start_date = fields.Date()
+ duration = fields.Float(digits=(6, 2), help="Duration in days")
+ seats = fields.Integer(string="Number of seats")
Index: addons/openacademy/views/openacademy.xml
===================================================================
--- addons.orig/openacademy/views/openacademy.xml 2014-08-27 10:35:29.179933749 +0200
+++ addons/openacademy/views/openacademy.xml 2014-08-27 10:36:54.643932480 +0200
@@ -64,5 +64,34 @@
<!-- Full id location:
action="openacademy.course_list_action"
It is not required when it is the same module -->
+
+ <!-- session form view -->
+ <record model="ir.ui.view" id="session_form_view">
+ <field name="name">session.form</field>
+ <field name="model">openacademy.session</field>
+ <field name="arch" type="xml">
+ <form string="Session Form">
+ <sheet>
+ <group>
+ <field name="name"/>
+ <field name="start_date"/>
+ <field name="duration"/>
+ <field name="seats"/>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <record model="ir.actions.act_window" id="session_list_action">
+ <field name="name">Sessions</field>
+ <field name="res_model">openacademy.session</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem id="session_menu" name="Sessions"
+ parent="openacademy_menu"
+ action="session_list_action"/>
</data>
</odoo>