Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
19474 Lượt xem

can anyone tem le clear answer. why this field is used for form or list view

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

From documentation:

This field priority is available in the view definition, and is 16 by default. By default, OpenERP will display a model using the view with the highest priority (the smallest number). For example, imagine we have two views for a simple model. The model client with two fields : firstname and lastname. We will define two views, one which shows the firstname first, and the other one which shows the lastname first.

<!--

Here is the first view for the model 'client'.

We don't specify a priority field, which means

by default 16.

-->

<record model="ir.ui.view" id="client_form_view_1">

<field name="name">client.form.view1</field>

<field name="model">client</field>

<field name="type">form</fiel>

<field name="arch" type="xml">

<field name="firstname"/>

<field name="lastname"/>

</field>

</record>

<!--

A second view, which show fields in an other order.

We specify a priority of 15.

-->

<record model="ir.ui.view" id="client_form_view_2">

<field name="name">client.form.view2</field>

<field name="model">client</field>

<field name="priority" eval="15"/>

<field name="type">form</fiel>

<field name="arch" type="xml">

<field name="lastname"/>

<field name="firstname"/>

</field>

</record>

Now, each time OpenERP will have to show a form view for our object client, it will have the choice between two views. It will always use the second one, because it has a higher priority ! Unless you tell it to use the first one !

Ảnh đại diện
Huỷ bỏ
Tác giả

thank for reply. Are you explained well .