Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Odoo 11 model registry loses model

Subscriure's

Get notified when there's activity on this post

This question has been flagged
keyerror
4 Respostes
5759 Vistes
Avatar
Ed Gow

Hi,

In an Odoo11 server running w/o change for many weeks a model_name key disappeared from the model registry. There was no change to the modules, configuration, etc. Restarting the Apache server hosting Odoo as a WSGI app fixed the problem. From the stack trace, this seems to be an issue with the Odoo model registry cache. Since the lost model was a non-Odoo addon, Odoo closed the issue w/o looking at the stack trace, which consists entirely of calls within their code. I'm posting the trace here to see if any other Odoo 11 users have seen similar problems. Here's the trace: 

```

[Wed May 09 16:27:50.293960 2018] [wsgi:error] [pid 20840:tid 139917498210048] ERROR:odoo.http:Exception during JSON request handling.
[Wed May 09 16:27:50.294113 2018] [wsgi:error] [pid 20840:tid 139917498210048] Traceback (most recent call last):
[Wed May 09 16:27:50.294166 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/fields.py", line 944, in __get__
[Wed May 09 16:27:50.294211 2018] [wsgi:error] [pid 20840:tid 139917498210048]     value = record.env.cache.get(record, self)
[Wed May 09 16:27:50.294255 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/api.py", line 960, in get
[Wed May 09 16:27:50.294297 2018] [wsgi:error] [pid 20840:tid 139917498210048]     value = self._data[field][record.id][key]
[Wed May 09 16:27:50.294339 2018] [wsgi:error] [pid 20840:tid 139917498210048] KeyError: <odoo.api.Environment object at 0x7f40fcd7e198>
[Wed May 09 16:27:50.294381 2018] [wsgi:error] [pid 20840:tid 139917498210048]
[Wed May 09 16:27:50.294422 2018] [wsgi:error] [pid 20840:tid 139917498210048] During handling of the above exception, another exception occurred:
[Wed May 09 16:27:50.294513 2018] [wsgi:error] [pid 20840:tid 139917498210048]
[Wed May 09 16:27:50.294565 2018] [wsgi:error] [pid 20840:tid 139917498210048] Traceback (most recent call last):
[Wed May 09 16:27:50.294607 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/http.py", line 646, in _handle_exception
[Wed May 09 16:27:50.294649 2018] [wsgi:error] [pid 20840:tid 139917498210048]     return super(JsonRequest, self)._handle_exception(exception)
[Wed May 09 16:27:50.294690 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/http.py", line 307, in _handle_exception
[Wed May 09 16:27:50.294732 2018] [wsgi:error] [pid 20840:tid 139917498210048]     raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
[Wed May 09 16:27:50.294774 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/tools/pycompat.py", line 87, in reraise
[Wed May 09 16:27:50.294816 2018] [wsgi:error] [pid 20840:tid 139917498210048]     raise value
[Wed May 09 16:27:50.294865 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/http.py", line 683, in dispatch
[Wed May 09 16:27:50.294912 2018] [wsgi:error] [pid 20840:tid 139917498210048]     result = self._call_function(**self.params)
[Wed May 09 16:27:50.294955 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/http.py", line 339, in _call_function
[Wed May 09 16:27:50.294997 2018] [wsgi:error] [pid 20840:tid 139917498210048]     return checked_call(self.db, *args, **kwargs)
[Wed May 09 16:27:50.295038 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/service/model.py", line 97, in wrapper
[Wed May 09 16:27:50.295079 2018] [wsgi:error] [pid 20840:tid 139917498210048]     return f(dbname, *args, **kwargs)
[Wed May 09 16:27:50.295120 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/http.py", line 332, in checked_call
[Wed May 09 16:27:50.295162 2018] [wsgi:error] [pid 20840:tid 139917498210048]     result = self.endpoint(*a, **kw)
[Wed May 09 16:27:50.295202 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/http.py", line 927, in __call__
[Wed May 09 16:27:50.295244 2018] [wsgi:error] [pid 20840:tid 139917498210048]     return self.method(*args, **kw)
[Wed May 09 16:27:50.295313 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/http.py", line 512, in response_wrap
[Wed May 09 16:27:50.295358 2018] [wsgi:error] [pid 20840:tid 139917498210048]     response = f(*args, **kw)
[Wed May 09 16:27:50.295400 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/addons/web/controllers/main.py", line 1200, in load
[Wed May 09 16:27:50.295443 2018] [wsgi:error] [pid 20840:tid 139917498210048]     action = request.env[action_type].browse([action_id]).read()
[Wed May 09 16:27:50.295485 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/addons/base/ir/ir_actions.py", line 194, in read
[Wed May 09 16:27:50.295527 2018] [wsgi:error] [pid 20840:tid 139917498210048]     result = super(IrActionsActWindow, self).read(fields, load=load)
[Wed May 09 16:27:50.295569 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/models.py", line 2520, in read
[Wed May 09 16:27:50.295611 2018] [wsgi:error] [pid 20840:tid 139917498210048]     values[name] = field.convert_to_read(record[name], record, use_name_get)
[Wed May 09 16:27:50.295653 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/models.py", line 4657, in __getitem__
[Wed May 09 16:27:50.295695 2018] [wsgi:error] [pid 20840:tid 139917498210048]     return self._fields[key].__get__(self, type(self))
[Wed May 09 16:27:50.295736 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/fields.py", line 948, in __get__
[Wed May 09 16:27:50.295778 2018] [wsgi:error] [pid 20840:tid 139917498210048]     self.determine_value(record)
[Wed May 09 16:27:50.295828 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/fields.py", line 1059, in determine_value
[Wed May 09 16:27:50.295876 2018] [wsgi:error] [pid 20840:tid 139917498210048]     self.compute_value(recs)
[Wed May 09 16:27:50.295919 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/fields.py", line 1015, in compute_value
[Wed May 09 16:27:50.295961 2018] [wsgi:error] [pid 20840:tid 139917498210048]     self._compute_value(records)
[Wed May 09 16:27:50.296002 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/fields.py", line 1006, in _compute_value
[Wed May 09 16:27:50.296044 2018] [wsgi:error] [pid 20840:tid 139917498210048]     getattr(records, self.compute)()
[Wed May 09 16:27:50.296085 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/addons/base/ir/ir_actions.py", line 154, in _compute_search_view
[Wed May 09 16:27:50.296127 2018] [wsgi:error] [pid 20840:tid 139917498210048]     fvg = self.env[act.res_model].fields_view_get(act.search_view_id.id, 'search')
[Wed May 09 16:27:50.296169 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/api.py", line 760, in __getitem__
[Wed May 09 16:27:50.296249 2018] [wsgi:error] [pid 20840:tid 139917498210048]     return self.registry[model_name]._browse((), self)
[Wed May 09 16:27:50.296301 2018] [wsgi:error] [pid 20840:tid 139917498210048]   File "/home/odoo11/odoo/odoo/modules/registry.py", line 181, in __getitem__
[Wed May 09 16:27:50.296386 2018] [wsgi:error] [pid 20840:tid 139917498210048]     return self.models[model_name]
[Wed May 09 16:27:50.296450 2018] [wsgi:error] [pid 20840:tid 139917498210048] KeyError: 'tidb.case'

Thanks

0
Avatar
Descartar
Avatar
melinda.hl.lim@gmail.com
Best Answer

Hi all! I'm sorry for posting a not-reply on this old post. However, I am encountering the same issue. As mentioned above, this error seems to appear randomly: one day the modules will load in fine, and the next day I'll get a keyerror:[model name]. May I ask, does anyone have a solution for this issue? Cheers!

0
Avatar
Descartar
Avatar
Ed Gow
Autor Best Answer

My original description of the problem is wrong. The real issue has to do with load order of model definitions during server start-up. This can happen intermittently if a module dependency is left out of the manifest file (thanks to Graeme Gellatly for this diagnosis). In my case the cause appears to be a bit different. I have models defined in two files. The order in which those files are loaded may be indeterminate, so on occasion the dependent one will be loaded first and cause a failure. 

Though the description is wrong, I think it may be worth leaving this post up to help others who may encounter a similar KeyError due to load failure. 

0
Avatar
Descartar
Ray Carnes

Can you clarify "the order in which those files are loaded may be indeterminate" - and have you seen https://github.com/odoo/odoo/issues/1053 ?

Ed Gow
Autor

I think that the problem I'm seeing is different than 1053 because it is intermittent. Almost all the time my module loads w/o any problem. On occasion it has a missing dependency. This would indicate that something changed from one start-up to another. Though I've yet to prove it, I suspect that the two files that define the models in my module are not loaded in a deterministic order. I don't know of a way to tell Odoo in what order to load files in the `models/` directory of a module.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
KeyError: line_ids after removing a One2many from a custom model (want to cleanly remove without uninstall)
keyerror
Avatar
0
d’ag. 25
1001
odoo module update not updating fully resulting in key value error
keyerror
Avatar
0
de nov. 23
2520
KeyError: 'socket' Solved
keyerror
Avatar
Avatar
Avatar
2
d’abr. 25
9350
Why is KeyError: 'teacher_id' ? Solved
keyerror
Avatar
Avatar
Avatar
6
de set. 21
24523
How do I fix KeyError Using Vals?
keyerror
Avatar
Avatar
1
de març 15
19496
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now