This question has been flagged
2 Replies
17122 Views

Hello! I used the software "Dia" to develop a module with OpenERP and I had this error, "TypeError: __init__() takes exactly 3 arguments (2 given)" and I do not see why

Here is my code with python:

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

from osv import fields,osv

class Recrutement_ONAEA(osv.osv):
    """(NULL)"""
    _name = 'Recrutement.ONAEA'
    _columns = {
        'Nom': fields.char('ONAEA',size="64"),
        'Adresse': fields.char('1bp 251, 37 Chemain Bachir El Ibrahimi-El Biar',size="64",),
        'NumTelephone': fields.char('021 92 13 03/04',size="64",,
        'WilayaOffice': fields.one2many('Recrutement.Annexe','Wilaya','Office annexe'),
    }
Recrutement_ONAEA()

class Recrutement_Annexe(osv.osv):
    """(NULL)"""
    _name = 'Recrutement.Annexe'
    _columns = {
        'Adresse': fields.char(''),
        'NumTelephone': fields.char(''),
        'Wilaya': fields.many2one('Recrutement.ONAEA','Annexe Office'),
        'WialayaCand': fields.one2many('Recrutement.Candidat','WilayaCandidat','Annexe candidat'),
    }
Recrutement_Annexe()

class Recrutement_Candidat(osv.osv):
    """(NULL)"""
    _name = 'Recrutement.Candidat'
    _columns = {
        'Nom': fields.char('Nom',size="10"),
        'Prenom': fields.char('Prénom',size="20"),
        'DateNaissance': fields.date(),
        'WilayaCandidat': fields.many2one('Recrutement.Annexe','Candidat annexe'),
        'Adresse': fields.text(),
        'CodePostal': fields.char('NNNNN',size="5"),
        'EMail': fields.char(),
        'NumTel': fields.char(size="10"),
    }
Recrutement_Candidat()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

If someone can help me I would be very grateful.

Thank you in advance.

Avatar
Discard
Best Answer

There is a missing closing parenthesis at the end line before comma: 'NumTelephone': fields.char('021 92 13 03/04',size="64"),

An extra comma after "size = "64" : 'Adresse': fields.char('1bp 251, 37 Chemain Bachir El Ibrahimi-El Biar',size="64",),

But that's not all !

You have to review all your code, beginning with naming conventions...

Avatar
Discard
Author

Thank you Med Said BARA I corrected the error, but the problem persists :(

Post the new code in your answer. And post more lines from your log

Which is the line 28 in your file ?

Author

(wrote in italic)

Author Best Answer
from osv import fields,osv

class Recrutement_ONAEA(osv.osv):
    """(NULL)"""
    _name = 'Recrutement.ONAEA'
    _columns = {

(LINE 28) 'Nom': fields.char('ONAEA',size="64"),`

            'Adresse': fields.char('1bp 251, 37 Chemain Bachir El Ibrahimi-El Biar',size="64"),
            'NumTelephone': fields.char('021 92 13 03/04',size="64"),
            'WilayaOffice': fields.one2many('Recrutement.Annexe','Wilaya','Office annexe'),
        }
Recrutement_ONAEA()

class Recrutement_Annexe(osv.osv):
    """(NULL)"""
    _name = 'Recrutement.Annexe'
    _columns = {
        'Adresse': fields.char(''),
        'NumTelephone': fields.char(''),
        'Wilaya': fields.many2one('Recrutement.ONAEA','Annexe Office'),
        'WialayaCand': fields.one2many('Recrutement.Candidat','WilayaCandidat','Annexe candidat'),
    }
Recrutement_Annexe()

class Recrutement_Candidat(osv.osv):
    """(NULL)"""
    _name = 'Recrutement.Candidat'
    _columns = {
        'Nom': fields.char('Nom',size="10"),
        'Prenom': fields.char('Prénom',size="20"),
        'DateNaissance': fields.date(),
        'WilayaCandidat': fields.many2one('Recrutement.Annexe','Candidat annexe'),
        'Adresse': fields.text(),
        'CodePostal': fields.char('NNNNN',size="5"),
        'EMail': fields.char(),
        'NumTel': fields.char(size="10"),
    }
Recrutement_Candidat()

and this is the same problem :

  File "C:\Program Files\OpenERP 6.1-1\server\openerp\addons\Diagramme2\Diagramme2.py", line 28, in Recrutement_ONAEA
TypeError: __init__() takes exactly 3 arguments (2 given)
Avatar
Discard

'Nom': fields.char('ONAEA', size=64),

Author

I just saw on another forum, and they say it gets between two quotes "" And in all cases, the problem persists (sorry, I have bad English)

Try to restart your server

Author

I rebooted the server , but in vain :(