how can I specify which views to use?

Asked by Cuong

Hi,

For example, I have a class A (test_a), with a field one2many, line_ids. line_ids points to other class, B (test_b). In form definition for class A, I want to display this field with different views.

With normal method, I use like this
<record id="test1" model="ir.ui.view">
    <field name="name">test1</field>
    <field name="model">test_a</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <field name="line_ids" >
            <tree>
            </tree>
            <form>
            </form>
        </field>
    </field>
</record>

But I want to do this way. I define different views for class test_b. Then in form definition for class A, I just specify which view to use, for example, I want to use view test_b_2. How can I specify this in class A?

<record id="test_b_1" model="ir.ui.view">
    <field name="name">test_b_1</field>
    <field name="model">test_b</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form>
        </form>
    </field>
</record>

<record id="test_b_2" model="ir.ui.view">
    <field name="name">test_b_2</field>
    <field name="model">test_b</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form>
        </form>
    </field>
</record>

Thanks,

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Web Client Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
digitalsatori(Shine IT) (digitalsatori) said :
#1

you can find the answer here:
http://doc.openerp.com/v6.0/developer/2_6_views_events/views/specify_view_to_use.html#specify-views-for-related-fields

On Thu, Jun 2, 2011 at 3:41 PM, Cuong
<email address hidden>wrote:

> New question #159985 on OpenERP Web Client:
> https://answers.launchpad.net/openobject-client-web/+question/159985
>
> Hi,
>
> For example, I have a class A (test_a), with a field one2many, line_ids.
> line_ids points to other class, B (test_b). In form definition for class A,
> I want to display this field with different views.
>
> With normal method, I use like this
> <record id="test1" model="ir.ui.view">
> <field name="name">test1</field>
> <field name="model">test_a</field>
> <field name="type">form</field>
> <field name="arch" type="xml">
> <field name="line_ids" >
> <tree>
> </tree>
> <form>
> </form>
> </field>
> </field>
> </record>
>
> But I want to do this way. I define different views for class test_b. Then
> in form definition for class A, I just specify which view to use, for
> example, I want to use view test_b_2. How can I specify this in class A?
>
> <record id="test_b_1" model="ir.ui.view">
> <field name="name">test_b_1</field>
> <field name="model">test_b</field>
> <field name="type">form</field>
> <field name="arch" type="xml">
> <form>
> </form>
> </field>
> </record>
>
> <record id="test_b_2" model="ir.ui.view">
> <field name="name">test_b_2</field>
> <field name="model">test_b</field>
> <field name="type">form</field>
> <field name="arch" type="xml">
> <form>
> </form>
> </field>
> </record>
>
> Thanks,
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Web Client.
>

Can you help with this problem?

Provide an answer of your own, or ask Cuong for more information if necessary.

To post a message you must log in.