Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
5986 มุมมอง

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

ผู้เขียน

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.

ผู้เขียน

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

คำตอบที่ดีที่สุด

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

ผู้เขียน

Thanks. :D

คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

you are welcome

Related Posts ตอบกลับ มุมมอง กิจกรรม
6
ธ.ค. 23
30707
1
มี.ค. 15
5427
2
ก.ย. 23
8497
1
ก.ย. 23
2689
2
มี.ค. 22
6559