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.

3

Change Type field [Closed]

By
Susi
on 12/21/14, 5:32 AM 1,359 views

The Question has been closed

by
Susi
on 01/21/2016 23:18:02

can u change type of field default in odoo... i want change type of field city in form customer become type field many2one.. anyone please help me with code

3
Susi
On 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?

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.

Ben Bernard
on 12/22/14, 12:15 AM

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

Susi
on 12/22/14, 1:29 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.

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

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

Baiju
on 12/22/14, 3:12 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.

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

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

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

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?

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

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

Ben Bernard
on 12/22/14, 10:27 PM
2

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/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

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/21/14, 5:32 AM
Seen: 1359 times
Last updated: 1/21/16, 11:18 PM