Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
10508 Visualizzazioni

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>-->
                <xpath expr="//field[@name='siren']" position="after">
                    <field name="societe_com" widget="url" attrs="{'invisible': [('is_company','!=',True)]}"/>
                </xpath>
                <xpath expr="//field[@name='child_ids']/form/div/group/field[@name='mobile']" position="after">
                    <field name="user_id" />
                </xpath>
            </field>
        </record>
        <!--
        <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"/>
                </xpath>
            </field>
        </record> -->

    </data>
</openerp>

res_partner.py:

# -*- 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 = {}
        text=""
        for obj in self.browse(cr, uid, ids, context=context):
            res[obj.id]=text
            if obj.siren  :
                text = "http://www.societe.com/cgi-bin/recherche?rncs=" + obj.siren
                res[obj.id]=text
        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)
    }
Avatar
Abbandona

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

Autore

Did you have post a bug on launchpad?

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

  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.
Autore

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.

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

Autore

ok I'll edit my question.

Risposta migliore

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.

Avatar
Abbandona
Autore

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

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.

Autore

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.

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

Risposta migliore

Try this:

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

    """your code here"""

x_res_partner()

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
mar 15
4353
0
mar 15
3129
6
set 24
52448
2
giu 20
20078
3
apr 16
9443