Odoo Help

Welcome!

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.

0

TypeError: __init__() takes exactly 3 arguments (2 given) ?

By
BATEL Amina
on 4/17/14, 1:33 PM 4,280 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.

0
BATEL Amina
On 4/17/14, 1:39 PM
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)

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

Med Said BARA
on 4/17/14, 5:34 PM

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)

BATEL Amina
on 4/17/14, 5:54 PM

Try to restart your server

Med Said BARA
on 4/17/14, 6:10 PM

I rebooted the server , but in vain :(

BATEL Amina
on 4/17/14, 6:23 PM
0

Med Said BARA

--Med Said BARA--
2664
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
On 4/17/14, 3:44 PM

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

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

BATEL Amina
on 4/17/14, 4:07 PM

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

Med Said BARA
on 4/17/14, 4:13 PM

Which is the line 28 in your file ?

Med Said BARA
on 4/17/14, 4:46 PM

(wrote in italic)

BATEL Amina
on 4/17/14, 4:57 PM

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

1 follower(s)

Stats

Asked: 4/17/14, 1:33 PM
Seen: 4280 times
Last updated: 3/16/15, 8:10 AM