콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
10540 화면

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)
    }
아바타
취소

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

작성자

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.
작성자

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.

작성자

ok I'll edit my question.

베스트 답변

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?

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.

작성자

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

베스트 답변

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.

아바타
취소
관련 게시물 답글 화면 활동
1
3월 15
4376
0
3월 15
3153
6
9월 24
52467
2
6월 20
20098
3
4월 16
9454