Hi Odoo developers,
I'm going to answer myself.
In my module I have a Course and a Session model. A course could be composed of zero, one or many sessions.
The Course model has associated a form view:
<record model="ir.ui.view" id="course_form_view">
<field name="name">course.form</field>
<field name="model">openacademy.course</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name"/>
<field name="responsible_id" string="Responsible"/>
</group>
<notebook>
<page string="Description">
<group>
<field name="description"/>
</group>
</page>
<page string="Ayuda">
<p>Another <strong>tab</strong></p>
</page>
<page string="Sessions">
<field name="session_ids">
<tree string="Course sessions">
<field name="name"/>
<field name="instructor_id"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
The session model has associated another 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>
<header>
<button name="draft" type="workflow"
string="Reset to draft"
states="confirmed,done"/>
<button name="confirm" type="workflow"
string="Confirm" states="draft"
class="oe_highlight"/>
<button name="done" type="workflow"
string="Mark as done" states="confirmed"
class="oe_highlight"/>
<button type="action"
name="openacademy.action_new_course1"
string="New course"
confirm="Do you want to create a new course?"/>
<field name="state" widget="statusbar"/>
</header>
<sheet>
<group string="General">
<field name="name" string="Session name"/>
<field name="course_id" string="Course"/>
<field name="instructor_id" string="Instructor"/>
</group>
<group string="Management">
<field name="start_date" string="Start date"/>
<field name="active" string="Activo"/>
<field name="duration" string="Duration (in days)"/>
<field name="seats"/>
<field name="percent_taken_seats" widget="progressbar"/>
</group>
<label for="attendees"/>
<field name="attendees"/>
</sheet>
</form>
</field>
</record>
In the above view there is a button with the string attribute equals to "New course":
<button type="action" name="openacademy.action_new_course1" string="New course"
confirm="Do you want to create a new course?"
/>
The button is associated with a window action using the attribute name="openacademy.action_new_course1".
This window action is defined in the same .xml file that this button:
<record id="action_new_course1" model="ir.actions.act_window">
<field name="name">Course</field>
<field name="res_model">openacademy.course</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">current</field>
</record>
The above window action open the form view defined for the Course model mentioned before.
Apart from this, you can have others window actions bind to the same Course model with differente values for view_mode. For example, I have another window action associated to the Course model:
<record model="ir.actions.act_window" id="action_openacademy_list_courses">
<field name="name">Courses Manager</field>
<field name="res_model">openacademy.course</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="context" eval="{'search_default_my_courses': 1}"/>
</record>
And this window action is bind to a menu item to open the Course model view:
<menuitem id="courses_menu" name="My Courses"
parent="openacademy_menu"
action="action_openacademy_list_courses"
/>
When I click on the menu named "My Courses", a tree view corresponding to the Course model is opened, and I have two more buttons to open the form and the calendar views associated to this model.
<record model="ir.actions.act_window" id="action_openacademy_list_courses">
<field name="name">Courses Manager</field>
<field name="res_model">openacademy.course</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="context" eval="{'search_default_my_courses': 1}"/>
</record>
I can't comment your answer Robert because I don't have enough karma. Thanks for your answer @Robert. I thought the same as you, but I would rather have an abstract class Task and childs classes inheriting from Task for the different kinds of Tasks (subclass Call, subclass Meeting, etc) using _inherit in my model.py file. Each subclass should have its own form view and each view should be opened when the user choose a kind of Task from the form view of the TypeTask model. The key is how to load dinamically a form view of a model from the form view of other module.