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.

2

Make Tree View [Closed]

By
Susi
on 12/23/14, 3:05 AM 980 views

The Question has been closed

by
Susi
on 01/21/2016 23:17:43

I want to make tree view in form Fed.state. i have code in xml

<record model="ir.ui.view" id="kabupaten_tree_view">
    <field name="name">Kabupaten.Line</field>
    <field name="model">res.country.state</field>
     <field name="inherit_id" ref="base.view_country_state_form"/>
    <field name="arch" type="xml">   
                 <page >
                    <field name="kab_ids" nolabel="1" colspan="4">
                        <tree string="Kabupaten" editable="bottom">
                            <field name="kd_kota" />
                               <field name="nm_kota" />
                            <field name="kd_provinsi" />
                            <field name="nm_provinsi" />    
                        </tree>   
                    </field>
                    </page>
    </field>
 </record>

and in .py

 

class kab_line (osv.osv):
    _inherit = 'res.country.state'
    _columns = {
        'kab_ids': fields.one2many('wtc.kabupaten', 'kd_kota'),
    }

but its error

Error details:
Element '<page>' cannot be located in parent view

Error context:
View `Kabupaten.Line`
[view_id: 866, xml_id: n/a, model: res.country.state, parent_id: 144]" while parsing /home/susi/odoo/addons/HONDA/wtc_master_kabupaten/master_kabupaten_view.xml:49, near
<record model="ir.ui.view" id="kabupaten_tree_view">
    <field name="name">Kabupaten.Line</field>
    <field name="model">res.country.state</field>
     <field name="inherit_id" ref="base.view_country_state_form"/>
    <field name="arch" type="xml">   
                 <page>
                    <field name="kab_ids" nolabel="1" colspan="4">
                        <tree string="Kabupaten" editable="bottom">
                            <field name="kd_kota"/>
                               <field name="nm_kota"/>
                            <field name="kd_provinsi"/>
                            <field name="nm_provinsi"/>    
                        </tree>   
                    </field>
                    </page>
    </field>
 </record>


anyone know why and where its error?

1
Susi
On 12/23/14, 4:53 AM

i get error

ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition

Error details:
Element '<sheet>' cannot be located in parent view

Error context:
View `kab.line`
[view_id: 883, xml_id: n/a, model: res.country.state, parent_id: 144]" while parsing /home/susi/odoo/addons/HONDA/wtc_master_kabupaten/master_kabupaten_view.xml:49, near
<record model="ir.ui.view" id="kabupaten_view">
    <field name="name">kab.line</field>
    <field name="model">res.country.state</field>
     <field name="inherit_id" ref="base.view_country_state_form"/>
    <field name="arch" type="xml">   
                <sheet>
                <notebook>
                <page string="Kabupaten">
                    <field name="kab_ids" nolabel="1" colspan="4">
                        <tree string="Kabupaten" editable="bottom">
                            <field name="kd_kota"/>
                               <field name="nm_kota"/>
                            <field name="kd_provinsi"/>
                            <field name="nm_provinsi"/>    
                        </tree>   
                    </field>
                  </page>
                  </notebook>
                  </sheet>
    </field>
 </record>

 

0

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3918
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 12/23/14, 5:39 AM

Try using xpath and add your form,

        <record model="ir.ui.view" id="kabupaten_view">
            <field name="name">kab.line</field>
            <field name="model">res.country.state</field>
            <field name="inherit_id" ref="base.view_country_state_form" />
            <field name="arch" type="xml">
                <xpath expr="//form[@string='State']" position="replace">
                    <form string="State" version="7.0">

                        <sheet>
                            <notebook>
                                <page string="Kabupaten">
                                    <field name="kab_ids" nolabel="1" colspan="4">
                                        <tree string="Kabupaten" editable="bottom">
                                            <field name="kd_kota" />
                                            <field name="nm_kota" />
                                            <field name="kd_provinsi" />
                                            <field name="nm_provinsi" />
                                        </tree>
                                    </field>
                                </page>
                            </notebook>
                        </sheet>
                    </form>
                </xpath>

            </field>
        </record>

(OR)

        <record model="ir.ui.view" id="kabupaten_view">
            <field name="name">kab.line</field>
            <field name="model">res.country.state</field>
            <field name="inherit_id" ref="base.view_country_state_form" />
            <field name="arch" type="xml">
                <xpath expr="//form[@string='State']" position="inside">
                    <separator string="Kabupaten" />
                    <field name="kab_ids" nolabel="1" colspan="4">
                        <tree string="Kabupaten" editable="bottom">
                            <field name="kd_kota" />
                            <field name="nm_kota" />
                            <field name="kd_provinsi" />
                            <field name="nm_provinsi" />
                        </tree>
                    </field>
                </xpath>
            </field>
        </record>

@atchuthan its work thank u :)

Susi
on 12/23/14, 5:58 AM
0

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
On 12/23/14, 3:58 AM

HI susi,

To give page tag, you have to use <notebook> tag.

ie, you have to give page inside notebook.

<notebook>

</notebook>

I think here you can use <sheet> tag

did you use notebook tag

Baiju
on 12/23/14, 4:53 AM

yes i have but its not work :(

Susi
on 12/23/14, 4:56 AM

when you use tag what error you are getting?

Baiju
on 12/23/14, 5:10 AM

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 12/23/14, 3:05 AM
Seen: 980 times
Last updated: 1/21/16, 11:17 PM