Odoo Help


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.


Problem with custom module.

Bonnet Denis
on 7/8/13, 10:52 AM 3,797 views

This is a problem I met for the second time.

I've made a custom module with all company parameter. this morning I wanted to work on Accounting functionality on a testing database. I duplicate the product database and my param module.

So now I have 2 databases and 2 Modules. One for production and one for testing.

I uninstall the param module from testing database and it's ok. I try to install the testing module and the system broke. I can't go to the login page and I have a message like : "the column 'test' don't exist in res_partner database". But I have a script that add this column.

Testing module is exactly the same than param module.

I don't understand why the same module don't work if I uninstall and reinstall a copy of it.

someone can explain me what I'm doing wrong?

Thanks for reading.

edit: My module code My xml file (I have comment the reference to the new field) <openerp> <data>

        <record model="ir.ui.view" id="partner_view_form_juliana">
            <field name="name">partner.view.form.juliana</field>
            <field name="model">res.partner</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="priority">52</field>
            <field name="arch" type="xml">
                <!--<xpath expr="//field[@name='nace_id']" position="before">
                    <field name="nom_commercial" attrs="{'invisible': [('is_company','!=',True)]}"/>
                <xpath expr="//field[@name='siren']" position="after">
                    <field name="societe_com" widget="url" attrs="{'invisible': [('is_company','!=',True)]}"/>
                <xpath expr="//field[@name='child_ids']/form/div/group/field[@name='mobile']" position="after">
                    <field name="user_id" />
        <record id="view_res_partner_filter_juliana" model="ir.ui.view">
            <field name="name">res.partner.select.juliana</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_res_partner_filter"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='user_id']" position="after">
                    <field name="nom_commercial"/>
        </record> -->



# -*- coding: utf-8 -*-
from openerp.osv import osv, fields
import logging

_logger = logging.getLogger("PARAM-JULIANA")
#Ajout du lien vers société.com

class res_partner(osv.osv):
    _name = 'res.partner'
    _inherit = 'res.partner'

    def _get_societe_com_link(self, cr, uid, ids, name, args, context=None):
        result = dict.fromkeys(ids, False)
        res = {}
        for obj in self.browse(cr, uid, ids, context=context):
            if obj.siren  :
                text = "http://www.societe.com/cgi-bin/recherche?rncs=" + obj.siren
        return res

    _columns = {
        'societe_com': fields.function(_get_societe_com_link, type='char', size=64, string='societe.com'),
        'nom_commercial': fields.char('Nom Commercial', size=128, select=True)

I ran into a similar problem when adding fields to mail.notification model. I couldn't figure it out so I used SQL to add the new fields to the table and that got it working. I'm guessing there is something in configuration data for base modules that prevents them being updated like with a custom module when you restart OpenERP. I can't find the culprit...

on 7/8/13, 11:02 AM

Did you have post a bug on launchpad?

Bonnet Denis
on 7/8/13, 11:15 AM

I honestly don't know if it is a bug or a feature I don't understand. I would look into the docs but usually cannot find anything helpful there...

on 7/8/13, 11:20 AM
  1. How do you duplicate the database? Using the webinterface of OE, or using command line?... 2. Why duplicate the module? Unless you change something, there is no need to do that. 3. If you want to change code, you better use a seperate system to do the testing, until it is working correctly.
on 7/8/13, 12:32 PM

I duplicate In the OS with GUI because I need to do some changes this month and I want to do my work on testing database on testing module, to not perturb the production platform. If you know another way to do the job you're welcome.

Bonnet Denis
on 7/8/13, 12:58 PM

Hi denis, please paste your code and xml over here.

Ghanshyam Prajapati
on 7/9/13, 6:56 AM

ok I'll edit my question.

Bonnet Denis
on 7/9/13, 7:27 AM

Grover Menacho

--Grover Menacho--
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Systems Engineer + MBA

Grover Menacho
On 7/8/13, 11:47 AM

Hello. Sometimes I face this problem when I'm trying to add a new field.

Here's what I do:

  1. First I remove the field from the view.

  2. I install the module

  3. I add the field again on the view

  4. I upgrade the module.

I don't know why this happens but to me this works.

thanks for your answer. But how can I install or uninstall the module if I can't go through the interface?

Bonnet Denis
on 7/8/13, 12:05 PM

You can't go through the interface because it's trying to read the view. Remove the conflictive field from the view. If that doesn't work restart your openerp server and that should work. Please tell me if it worked for you.

GH Mediacloud, Grover Menacho
on 7/8/13, 1:45 PM

I'n having this error: ProgrammingError: ERREUR: la colonne res_partner.nom_commercial n'existe pas LIGNE 1 : SELECT res_partner."ean13",res_partner."nom_commercial",res_... I think I have to restart the module but I didn't have the rigth to do that with a command line.

Bonnet Denis
on 7/9/13, 5:59 AM

Hmmm. Another way is deleting the xml line from your __openerp__.py you can delete your view and restart your server or your pc if you don't have the permissions to restart your server... Then you are not going to see that error anymore. You can install the module as always. And then you can add again that file to the __openerp__.py

GH Mediacloud, Grover Menacho
on 7/9/13, 11:00 AM
On 7/9/13, 11:20 AM

Try this:

class x_res_partner(osv.osv):
    _name = 'res.partner'
    _inherit = 'res.partner'

    """your code here"""


I think the problem is with your inheritance. Give your class a different name from the class you inherit and then instantiate it.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

0 follower(s)


Asked: 7/8/13, 10:52 AM
Seen: 3797 times
Last updated: 3/16/15, 8:10 AM