Skip to Content
Menu
This question has been flagged
2 Replies
2614 Views

Hello, I created a custom module in Odoo.sh. I tried to install my module in my database. But When ever i try to install the terminal show me this kind of errors : Error:

Odoo Server Error

Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/http.py", line 624, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/home/odoo/src/odoo/odoo/http.py", line 310, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/home/odoo/src/odoo/odoo/tools/pycompat.py", line 14, in reraise

    raise value

  File "/home/odoo/src/odoo/odoo/http.py", line 669, in dispatch

    result = self._call_function(**self.params)

  File "/home/odoo/src/odoo/odoo/http.py", line 350, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper

    return f(dbname, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/http.py", line 339, in checked_call

    result = self.endpoint(*a, **kw)

  File "/home/odoo/src/odoo/odoo/http.py", line 915, in __call__

    return self.method(*args, **kw)

  File "/home/odoo/src/odoo/odoo/http.py", line 515, in response_wrap

    response = f(*args, **kw)

  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1331, in call_button

    action = self._call_kw(model, method, args, kwargs)

  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1319, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/odoo/src/odoo/odoo/api.py", line 387, in call_kw

    result = _call_kw_multi(method, model, args, kwargs)

  File "/home/odoo/src/odoo/odoo/api.py", line 374, in _call_kw_multi

    result = method(recs, *args, **kwargs)

  File "<decorator-gen-60>", line 2, in button_immediate_install

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_module.py", line 72, in check_and_log

    return method(self, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_module.py", line 463, in button_immediate_install

    return self._button_immediate_function(type(self).button_install)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function

    modules.registry.Registry.new(self._cr.dbname, update_module=True)

  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 86, in new

    odoo.modules.load_modules(registry._db, force_demo, status, update_module)

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 423, in load_modules

    loaded_modules, update_module, models_to_check)

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 315, in load_marked_modules

    perform_checks=perform_checks, models_to_check=models_to_check

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 201, in load_module_graph

    registry.setup_models(cr)

  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 262, in setup_models

    model._setup_fields()

  File "/home/odoo/src/odoo/odoo/models.py", line 2735, in _setup_fields

    field.setup_full(self)

  File "/home/odoo/src/odoo/odoo/fields.py", line 433, in setup_full

    self._setup_related_full(model)

  File "/home/odoo/src/odoo/odoo/fields.py", line 486, in _setup_related_full

    field = target._fields[name]

KeyError: 'res'.


This is the Content of my manifest file :

{

    'name': 'Audit',

    'version': '1.0',

    'author': '',

    'summary': 'Immobilisations Audit Management System',

    'description': 'This is immobilisations audit management software. This module is supported in Odoo V13',

    'category': 'Immobilisations Audit',

    'website': '',

    'depends': ['base','mail'],

    'data': ['security/ir.model.access.csv',

                   'views/site.xml'],

    'demo': [],

    'qweb': [],

    

    'installable': True,

    'application': True,

    'auto_install': False,

}


And this is my model :

from odoo import fields, models

from datetime import datetime


class AuditSite(models.Model):

    _name = 'audit.site'

    _inherit = ['mail.thread', 'mail.activity.mixin']

    _description = 'Site Table'

    

    name = fields.Char(string= "Name", required= True)

    adresse = fields.Char(string= "Adresse")

    audit_date = fields.Datetime(string= "Audit Date")

    contact = fields.Many2one('res.partner', string= "Contact")

    contact_phone = fields.Char(related= 'res.partner.phone', string= "Contact Phone")

    contact_email= fields.Char(related= 'res.partner.email', string= "Contact Email")

    zone = fields.Selection([('conakry', 'Conakry'),

                            ('interior', 'Interior')], string="Zone", default='conakry')

    municipalitie_prefecture = fields.Char(string= "Municipalities / Prefectures")

    site_manager = fields.Many2one('hr.employee', string="Site Manager")

    site_value = fields.Monetary(string="Site Value")

    installations_details = fields.Text(string="Installations Details")

    occupation = fields.Char(string="Occupation")

    legality = fields.Selection([('legal', 'Legal'),

                                ('illegal', 'Illegal'),

                                ('illegal (other people)', 'Illegal (Other People)')], string="Legality", default='legal')

    validity = fields.Datetime(string="Validity")

    number_of_pylones = fields.Integer(string="Number")

    flatsharing = fields.Char(string="Flatsharing")

    generator = fields.Char(string="Generator")

    bts = fields.Char(string="BTS")

    observations = fields.Char(string="OBSERVATIONS")

    edg = fields.Char(string="EDG")

    ge = fields.Char(string="GE")

    bbat = fields.Char(string="B BAT")

    earth = fields.Char(string="EARTH")

    balyse = fields.Char(string="BALYSE")

    parat = fields.Char(string="PARAT")

    fh = fields.Integer(string="FH")

    rru = fields.Integer(string="RRU")

    feeder = fields.Integer(string="FEEDER")

    ac = fields.Integer(string="AC")

    fiber = fields.Integer(string="FIBER")

    gsm = fields.Integer(string="GSM")

    site_image = fields.Binary(string="Site Image")

Avatar
Discard

Please use regular formatting.

Best Answer

Hello, 

I believe the issue is your related fields.

Could you change the these fields please:

    contact_phone = fields.Char(related= 'res.partner.phone', string= "Contact Phone")

    contact_email= fields.Char(related= 'res.partner.email', string= "Contact Email")

to:

    contact_phone = fields.Char(related= 'contact.phone', string= "Contact Phone")

    contact_email= fields.Char(related= 'contact.email', string= "Contact Email")

The relation needs to know what object to look at rather than looking driectly at the model.

Thanks, 

Avatar
Discard
Author Best Answer

Thank you very much.

Avatar
Discard