Odoo Help


Column x does not exist error (custom module)

on 12/20/14, 7:02 AM 4,870 views

Hello everyone


I've added a column to my custom module as show in the example below:

class res_partner(osv.osv): 
_inherit = 'res.partner'
_columns = { 'x_invoice_partner': fields.boolean('Invoice partner', help="Select this if you want to send invoices to this person")

Then I added that field to my custom XML file as shown below:

<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field eval="1" name="priority"/>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='use_parent_address']" position="after">
<field name="x_invoice_partner"/> </xpath>
</field> </record>

When I save this and restart the server I get this message: "column res_partner.x_invoice_partner does not exist" when I want to login. What exactly am I doing wrong here? Thanks in advance

EDIT: Sorry @zbik apparently I don't have enough karma to react to someone's response, I can't update the module since I get the error message when login. So I can't get past the login screen and thus can't get to the settings. Thanks in advance


You have a spaces or tabs before _inherit and before _columns?

on 12/20/14, 7:09 AM

@zbik Yes I have a tab before both of them, sorry I couldn't properly edit it in the post

on 12/20/14, 7:11 AM

You have a column 'x_invoice_partner' in database? (you upgrade your module or only restart the server?)

on 12/20/14, 7:33 AM

@zbik I've only restarted the server, I've read something about updating the database with a command in the terminal, is this needed?

on 12/20/14, 7:46 AM

Maybe add a column in the database manually, should help.

on 12/20/14, 8:16 AM

You update all modules by (if ubuntu or debian): $su - odoo -s /bin/bash $/usr/bin/openerp-server -d YOURDATABASE -u all --stop-after-init --config="/etc/openerp/openerp-server.conf"

on 12/20/14, 8:21 AM

If you are logged in, then remove from the database, and you perform Upgrade.

on 12/20/14, 8:50 AM


| 6 5 7
Lodz, Poland

On 12/20/14, 7:52 AM

Update your module on admin site Settings/Local Modules. You remove filter "Apps", search your module name, open view, and click on "Upgrade".


Med Said BARA

--Med Said BARA--

| 5 5 7
--Med Said BARA--
Med Said BARA
On 12/20/14, 9:01 AM

To avoid any confusion and If you just want to add a new field "x_invoice_partner'" to the class res_partner and display it in the base.view_partner_form;

Give to your class a distinguished name: my_respartner and use a "Class Inheritance" by adding  _name = 'res.partner' in your class definition.

class my_respartner(osv.osv): 

_name = 'res.partner'

_inherit = 'res.partner' 

_columns = 

     { 'x_invoice_partner': fields.boolean('Invoice partner', help="Select this if you want to send invoices to this person")


Do the same for the view in .xml (to avoid any confusion and form name conflict): 

<record id="view_partner_form_sendinvoice" model="ir.ui.view"> or 

<field name="name">res.partner.form.sendinvoice</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='use_parent_address']" position="after">
<field name="x_invoice_partner"/> 



Last, respect the indentation.

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.


Odoo Training Center

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

Test it now

Question tools

2 follower(s)


Asked: 12/20/14, 7:02 AM
Seen: 4870 times
Last updated: 3/16/15, 8:10 AM