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.

0

Why is my custom field not appearing in partner form? [Closed]

By
David Dean
on 10/17/13, 8:42 PM 1,047 views

The Question has been closed

by
Ray Carnes
on 10/18/2013 18:22:34

I'm trying to add a simple field to the partner details form. I've created a module which loads with no errors in the OpenERP debug logs, and I can see the new field being added to the database.

The problem is the field is not displaying when viewing or editing the partner form.

I'm using a fresh install of OpenERP 7.0 and I am testing with the Admin user.

I'm sure there is an obvious answer to this question but after hours of trying to figure it out I've given up!

bespoke_customer_form.py

from osv import osv, fields
from tools.translate import _

class res_partner(osv.osv):

  _inherit = 'res.partner'

  _columns = {
        'bespoke_id': fields.integer('Bespoke ID', size=11, help='Test'),
        }

res_partner()

bespoke_customer_form.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <record model="ir.ui.view" id="view_partner_form">
      <field name="name">res.partner.form</field>
      <field name="model">res.partner</field>
      <field name="type">form</field>
      <field name="inherit_id" ref="base.view_partner_form" />
      <field name="arch" type="xml">
        <field name="email" position="after">
          <field name="bespoke_id" />
        </field>
      </field>
    </record>
  </data>
</openerp>

Click the edit button in your form view and verify whether the custom field has been appeared or not

Abhishek H Menon
on 10/18/13, 7:04 AM

Hi Abhishek - no, my custom field has not appeared in the form edit view. That's the problem I'm trying to fix. As far as I can tell the module configuration above is correct.

David Dean
on 10/18/13, 7:32 AM
0
kaynis
On 10/18/13, 10:57 AM

Try this

        <data>
            <xpath expr="//field[@name='address']//field[@name='email']" position="before">
                <field name="bespoke_id" select="2"/>
            </xpath>
        </data>

to replace

       <field name="email" position="after">
0
David Dean
On 10/18/13, 7:44 AM

Okay, I managed to fix this. It turns out I was missing the line in __openerp__.py which defined the XML file to load. After adding the line below and re-installing the module the custom field has appeared.

__openerp__.py

'data' : ['bespoke_customer_form.xml'],

I knew it would be a newbie mistake!

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 10/17/13, 8:42 PM
Seen: 1047 times
Last updated: 3/16/15, 8:10 AM