Odoo Help

Welcome!

This community 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.

0

One view, two forms, two tables

By
Uillino
on 7/29/15, 9:41 AM 765 views

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

 <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<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">
<sheet>
<group name="top">
<group name="left">
<field name="code_1"/>
</group>
<group name="left">
<field name="description_1"/>
</group>
</group>
</sheet>
</form>
</field>
</record>

<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">
<sheet>
<group name="top">
<group name="left">
<field name="code_2"/>
</group>
<group name="left">
<field name="description_2"/>
</group>
</group>
</sheet>
</form>
</field>
</record>

<!-- 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" />

</data>
</openerp>

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).

PY
on 7/29/15, 11:13 AM
0
Uillino
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.

0

Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
896
| 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.

https://www.linkedin.com/profile/public-profile-settings?trk=prof-edit-edit-public_profile

tibrahim@2p.com.sa

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'

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/29/15, 9:41 AM
Seen: 765 times
Last updated: 7/30/15, 3:25 AM