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

Key error

By
soumaya
on 3/25/16, 5:40 AM 438 views

Hello 

I'm debutant in odoo development , and wrote this test module:

***********************************************

class documents(osv.Model):

_name = 'documents'

_description = u'Association class'

_columns = {

'nom': fields.char(_(u'nom et prenom'), size=128, required=True),

'date_de_naissance': fields.date(_(u'Date de naissance')),

'Etat_civile ': fields.selection([('celebataire','celebataire'),('marie','marie'),('devorce','devorcé'),('veuf','veuf')],string=_(u'Etat civile')),

'Genre': fields.selection([('homme','homme'),('femme','femme')],string=_(u'Genre')),

'numero_cin': fields.integer(_(u'numero cin')),

'adresse': fields.char(_(u'Adresse')),

'line_id': fields.one2many('documents.line', 'documents_id', string=_(u'Presentation de la famille')),

    }

**************************

class documents(osv.Model):

_name = 'documents.line'

_description = u'Documents line class'

_columns = {

'documents_id': fields.many2one('documents', _(u'membrefamille')),

'nom_et_prenom': fields.char(_(u'Nom et prenom'),size=512),

'date_de_naissance': fields.date(_(u'Date de naissance')),

'parente': fields.char(_(u'Parente'),size=512),

'profession': fields.char(_(u'Profession'),size=512),

'niveau_etude': fields.char(_(u'Niveau d etude'), size = 512),

'remarques': fields.char(_(u'Remarque'),size=512),

'numero_telephone': fields.integer(_(u'Numero de telephone')),

    }

********************

When I try to install it, I get this error:

Odoo Server Error


Traceback (most recent call last):
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\http.py", line 539, in _handle_exception
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\http.py", line 576, in dispatch
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\http.py", line 312, in _call_function
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\service\model.py", line 118, in wrapper
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\http.py", line 309, in checked_call
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\http.py", line 805, in __call__
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\http.py", line 405, in response_wrap
  File "C:\Program Files\Odoo 8.0-20160315\server\openerp\addons\web\controllers\main.py", line 948, in call_button
  File "C:\Program Files\Odoo 8.0-20160315\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\api.py", line 268, in wrapper
  File "C:\Program Files\Odoo 8.0-20160315\server\openerp\addons\base\module\module.py", line 447, in button_immediate_install
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\api.py", line 268, in wrapper
  File "C:\Program Files\Odoo 8.0-20160315\server\openerp\addons\base\module\module.py", line 495, in _button_immediate_function
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\modules\registry.py", line 370, in new
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\modules\loading.py", line 355, in load_modules
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\modules\loading.py", line 255, in load_marked_modules
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\modules\loading.py", line 156, in load_module_graph
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\modules\registry.py", line 194, in setup_models
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\api.py", line 268, in wrapper
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\api.py", line 372, in old_api
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\models.py", line 3006, in _setup_fields
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\fields.py", line 470, in setup
  File "C:\Program Files\Odoo 8.0-20160315\server\.\openerp\fields.py", line 1770, in _setup_regular
KeyError: 'documents_id'

1

Axel Mendoza

--Axel Mendoza--
10308
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 3/25/16, 9:05 PM

Your issue is that you name the 2 classes with the same name in the same file. You could solve it like this:

class documents(osv.Model):

_name = 'documents'

...

...

class documents_line(osv.Model):

_name = 'documents.line'

...

...

Welcome to Odoo

0
soumaya
On 3/28/16, 3:57 AM

Hello , i did this modification as you said but an other error occurs 

what error occurs ?

Jignesh Mehta
on 3/28/16, 5:38 AM

this error occurs : XmlHttpRequestError INTERNAL SERVER ERROR

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

soumaya
on 3/28/16, 5:40 AM

Please show detailled log like you did for your 1st post

David Verove
on 3/29/16, 8:47 AM

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: 3/25/16, 5:40 AM
Seen: 438 times
Last updated: 3/28/16, 3:57 AM