Odoo Help


One view, two forms, two tables

on 7/29/15, 9:41 AM 1,611 views

I have created a simple module. This is the view:

 <?xml version="1.0" encoding="utf-8"?>
<record id="view_test_1" model="ir.ui.view">
<field name="name">Test 1</field>
<field name="model">test.tbl_1</field>
<field name="arch" type="xml">
<form string="Test 1">
<group name="top">
<group name="left">
<field name="code_1"/>
<group name="left">
<field name="description_1"/>

<record id="view_test_2" model="ir.ui.view">
<field name="name">Test 2</field>
<field name="model">test.tbl_2</field>
<field name="arch" type="xml">
<form string="Test 2">
<group name="top">
<group name="left">
<field name="code_2"/>
<group name="left">
<field name="description_2"/>

<!-- Action to open To-do Task list -->
<act_window id="action_test_1" name="Attivita" res_model="test.table_1" view_mode="tree,form" />
<act_window id="action_test_2" name="Servizio" res_model="test.table_2" view_mode="tree,form" />
<!-- Menu item to open To-do Task list -->
<menuitem id="menu_test_1" name="Menu test 1" parent="mail.mail_feeds" sequence="20" action="action_test_1" />
<menuitem id="menu_test_2" name="Menu test 2" parent="mail.mail_feeds" sequence="30" action="action_test_2" />


and this is my model:

# -*- encoding: utf-8 -*-
from openerp import models, fields

class test_1(models.Model):
_name = 'test.table_1'
_description = 'Table 1'

code_1 = fields.Char('Code', size=1, help="Insert your code", required=True)
description_1 = fields.Text('Description', help="Insert a description", required=True)

class test_2(models.Model):
_name = 'test.table_2'
_description = 'Table 2'

code_2 = fields.Char('Code', size=1, help="Insert your code", required=True)
description_2 = fields.Text('Description', help="Insert a description", required=True)

So, I have two links in the "messaging" menu, one for each action.

Instead, I need only one link to a view with two forms. I would like to chose which one to fill (only one or both).

Anyone coul help me? Thanks in advance!

In your view, there are tags mismatch (group and sheet).

on 7/29/15, 11:13 AM
On 7/30/15, 3:25 AM

Thank your for your reply, Tarek.

I thought to something like this: one views with two tabs (one for each form).

Any suggestion?

PY, the tags 'group' and 'sheet' are not mismatched. They are not correctly indented.


Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
| 5 3 7
Gîza, Egypt
--Tarek Mohamed Ibrahim--

I am an old VFP developer on ERP

I have moved to 2p since Nov-2014 and started developing with Python on Odoo.



Tarek Mohamed Ibrahim
On 7/29/15, 10:44 AM

I suggest the following scenario:

You have to create a wizard screen that has a popup to select one of the two views.

Create a link to open this wizard, and in the 'OK' button of the wizard you have to return an action that calls the selected view.

In this case no need for the created two actions above.

search the odoo code to get how to build an action programmatically, use the key word:

'type': 'ir.actions.act_window'

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 7/29/15, 9:41 AM
Seen: 1611 times
Last updated: 3/27/18, 2:59 AM