Odoo Help

3

1
2 Answers
3
Susi Indonesia
12/21/14, 9:49 PM

To All

i havecode for invisible the field of city

<record model="ir.ui.view" id="field_kab">
    <field name="name">field</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
    <field name="arch" type="xml">
            <xpath expr="//field[@name='kel_id']" position="after">
             <field name="city" invisible="1" />
         </xpath>
    </field>
</record>

but it doesnt work, and error

Error details:
Element '<xpath expr="//field[@name='kel_id']">' cannot be located in parent view

Error context:
View `field`
[view_id: 840, xml_id: n/a, model: res.partner, parent_id: 126]" while parsing /home/susi/odoo/addons/HONDA/wtc_master_kabupaten/master_kabupaten_view.xml:50, near
<record model="ir.ui.view" id="field_kab">
    <field name="name">field</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
    <field name="arch" type="xml">
            <xpath expr="//field[@name='kel_id']" position="after">
             <field name="city" invisible="1"/>
         </xpath>
    </field>
</record>

 

please if anyone can help me?

8 Comments
Ben Bernard Indonesia
12/22/14, 12:15 AM

I think you should create new field to maintain compatibility with existing codebase. Changing field will break the compatibility (hence you have to migrate), so I think it's safer and easier to make new field.

Susi Indonesia
12/22/14, 1:29 AM

if i make new field (city_new),,then default field city invisible??

Ben Bernard Indonesia
12/22/14, 1:45 AM

Yeah, you can do that. But, I want to mention that class kab is not a good candidate to inherit from res.partner model. I think it nicer if you inherit it from res.partner.address.

Baiju KS India
12/22/14, 3:12 AM

You can make that invisible by inheriting that form in xml file

Ivan Indonesia
12/22/14, 4:52 AM

res.partner.address has been deprecated since v7.0. For v7.0 onwards it is correct to inherit from res.partner to add attributes to the address.

Ben Bernard Indonesia
12/22/14, 5:38 AM

Ah, thx for clarification. I did only checked version 6.1.

Susi Indonesia
12/22/14, 10:08 PM

Hi All,, i have code for invisible field city field res.partner <xpath expr="//field[@name='kel_id']" position="after"> but it doesnt work and error,,,please if anyone can help me?

Ben Bernard Indonesia
12/22/14, 10:27 PM

Use xpath to search the city and change it's attribute.

2
Avatar

Baiju KS India

--Baiju KS--
3508
| 6 5 10
Kochi, India
--Baiju KS--
ODOO technical

        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 KS India
12/21/14, 7:59 AM

Hi,

You can inherit the object and change the type of that field or you can define  a new filed in that object and use that for your need

Ask a Question
Writer
145
Susi
Tag
Keep Informed
1 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now