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.

1

How to declare views in openerp 7.0?

By
Carlos Llamacho
on 6/18/13, 3:01 PM 2,093 views

This is usually how i declare a view in openerp 6.1 and so far has worked correctly...

But i started a project with openerp 7.0 and this view appears as undefined in the debug mode and can't seem to see why.

<record model="ir.ui.view" id="stock_location_department_view">
    <field name="name">stock.location.form</field>
    <field name="model">stock.location</field>
    <field name="inherit" ref="stock.view_location_form" />
    <field name="type">form</field>
    <field name="arch" type="xml">
        <field name="company_id" position="after">
            <field name="department_id"/>
        </field>
    </field>
</record>

what is the error you are getting ? can you please log it here

Pravitha
on 6/19/13, 2:07 AM

That's the weird thing, it doesn't give me an error, it just doesn't show the field department_id. The view appears in the debug, but where it should say Form or Tree, it justs says undefined.

Carlos Llamacho
on 6/19/13, 2:10 AM

Actually, now that i look better at the code... shouldn't it be <field name="inherit_id" ???? I think that may be it.

Carlos Llamacho
on 6/19/13, 2:12 AM
1

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 6/18/13, 7:54 PM

Hi,

use xpath expr :

 <xpath expr="//field[@name='company_id']" position="after" >
           <field name="department_id"/>
  </xpath>

Somebody commented me that xpath expressions are outdated. Is this true? Also, what is the logic of a xpath expr, i don

Carlos Llamacho
on 6/19/13, 12:16 AM

Thanks. :D

Carlos Llamacho
on 6/25/13, 4:48 PM
2

Sandeep

--Sandeep--
6083
| 6 5 8
Delhi, India
--Sandeep--
Python OpenERP Developer http://in.linkedin.com/pub/sandeep-rana/3b/a16/786/
Sandeep
On 6/19/13, 3:45 AM

Hi

try this without form field.

                   <record model="ir.ui.view" id="stock_location_department_view">
                  <field name="name">stock.location.form</field>
                   <field name="model">stock.location</field>
                 <field name="inherit_id" ref="stock.view_location_form" />
                 <field name="arch" type="xml">
                 <field name="company_id" position="after">
                     <field name="department_id"/>
                     </field>
               </field>

Thanks
Sandeep

0
Pravitha
On 6/19/13, 3:30 AM

Try this cde: It is inherit_id

<record model="ir.ui.view" id="stock_location_department_view">
<field name="name">stock.location.form</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_form" />
<field name="type">form</field>
<field name="arch" type="xml">
    <field name="company_id" position="after">
        <field name="department_id"/>
    </field>
</field>

</record>

Yes, this was my mistake. Thank you very much.

Carlos Llamacho
on 6/21/13, 11:40 AM

you are welcome

Pravitha
on 6/24/13, 1:49 AM

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

0 follower(s)

Stats

Asked: 6/18/13, 3:01 PM
Seen: 2093 times
Last updated: 3/16/15, 8:10 AM