Я пытаюсь унаследовать products.products от модуля website_sale, чтобы изменить там некоторые свойства. Но когда я пытаюсь унаследовать его, возникает ошибка. Код из моего модуля models.py:
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class imgtogif_r(models.Model):
_inherit = 'product.product'
_name = 'product.product'
# _description = 'imgtogif_r.imgtogif_r'
# name = fields.Char()
# value = fields.Integer()
# value2 = fields.Float(compute="_value_pc", store=True)
# description = fields.Text()
#
# @api.depends('value')
# def _value_pc(self):
# for record in self:
# record.value2 = float(record.value) / 100
Модуль был создан с использованием метода scaffold odoo. Сервер cra sh (ниже - журнал ошибок, а в браузере - ошибка 500) возникает только тогда, когда я пытаюсь добавить _inherit в свой models.py
Журнал ошибок:
2020-05-09 10:51:49,361 15798 INFO ? odoo: Odoo version 13.0-20200509
2020-05-09 10:51:49,361 15798 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf
2020-05-09 10:51:49,361 15798 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/var/lib/odoo/.local/share/Odoo/addons/13.0']
2020-05-09 10:51:49,362 15798 INFO ? odoo: database: odoo@default:default
2020-05-09 10:51:49,469 15798 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports.
2020-05-09 10:51:49,526 15798 WARNING ? odoo.addons.base.models.res_currency: The num2words python library is not installed, amount-to-text features won't be fully available.
2020-05-09 10:51:49,546 15798 INFO ? odoo.service.server: HTTP service (werkzeug) running on raitis-VirtualBox:8069
2020-05-09 10:51:52,515 15798 INFO ? odoo.http: HTTP Configuring static files
2020-05-09 10:51:52,523 15798 INFO odoodb odoo.modules.loading: loading 1 modules...
2020-05-09 10:51:52,532 15798 INFO odoodb odoo.modules.loading: 1 modules loaded in 0.01s, 0 queries
2020-05-09 10:51:52,547 15798 INFO odoodb odoo.modules.loading: loading 58 modules...
2020-05-09 10:51:52,551 15798 WARNING odoodb odoo.modules.loading: Transient module states were reset
2020-05-09 10:51:52,551 15798 ERROR odoodb odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 60, in __new__
return cls.registries[db_name]
File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 69, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: 'odoodb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 417, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 313, in load_marked_modules
loaded, processed = load_module_graph(
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 191, in load_module_graph
model_names = registry.load(cr, package)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 222, in load
model = cls._build_model(self, cr)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 521, in _build_model
raise TypeError("Model %r does not exist in registry." % name)
TypeError: Model 'product.product' does not exist in registry.
2020-05-09 10:51:52,553 15798 INFO odoodb werkzeug: 10.0.2.2 - - [09/May/2020 10:51:52] "GET /web HTTP/1.1" 500 - 9 0.005 0.032
2020-05-09 10:51:52,556 15798 ERROR odoodb werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 60, in __new__
return cls.registries[db_name]
File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 69, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: 'odoodb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 306, in run_wsgi
execute(self.server.app)
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 294, in execute
application_iter = app(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 439, in app
return self.app(e, s)
File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 142, in application
return application_unproxied(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 117, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1287, in __call__
return self.dispatch(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1257, in __call__
return self.app(environ, start_wrapped)
File "/usr/lib/python3/dist-packages/werkzeug/middleware/shared_data.py", line 220, in __call__
return self.app(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1439, in dispatch
odoo.registry(db).check_signaling()
File "/usr/lib/python3/dist-packages/odoo/__init__.py", line 104, in registry
return modules.registry.Registry(database_name)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 62, in __new__
return cls.new(db_name)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 417, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 313, in load_marked_modules
loaded, processed = load_module_graph(
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 191, in load_module_graph
model_names = registry.load(cr, package)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 222, in load
model = cls._build_model(self, cr)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 521, in _build_model
raise TypeError("Model %r does not exist in registry." % name)
TypeError: Model 'product.product' does not exist in registry. - - -
2020-05-09 10:51:52,806 15798 INFO odoodb odoo.modules.loading: loading 1 modules...
2020-05-09 10:51:52,815 15798 INFO odoodb odoo.modules.loading: 1 modules loaded in 0.01s, 0 queries
2020-05-09 10:51:52,831 15798 INFO odoodb odoo.modules.loading: loading 58 modules...
2020-05-09 10:51:52,831 15798 WARNING odoodb odoo.modules.loading: Transient module states were reset
2020-05-09 10:51:52,831 15798 ERROR odoodb odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 60, in __new__
return cls.registries[db_name]
File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 69, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: 'odoodb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 417, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 313, in load_marked_modules
loaded, processed = load_module_graph(
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 191, in load_module_graph
model_names = registry.load(cr, package)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 222, in load
model = cls._build_model(self, cr)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 521, in _build_model
raise TypeError("Model %r does not exist in registry." % name)
TypeError: Model 'product.product' does not exist in registry.
2020-05-09 10:51:52,833 15798 INFO odoodb werkzeug: 10.0.2.2 - - [09/May/2020 10:51:52] "GET /favicon.ico HTTP/1.1" 500 - 9 0.003 0.028
2020-05-09 10:51:52,836 15798 ERROR odoodb werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 60, in __new__
return cls.registries[db_name]
File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 69, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: 'odoodb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 306, in run_wsgi
execute(self.server.app)
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 294, in execute
application_iter = app(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 439, in app
return self.app(e, s)
File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 142, in application
return application_unproxied(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 117, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1287, in __call__
return self.dispatch(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1257, in __call__
return self.app(environ, start_wrapped)
File "/usr/lib/python3/dist-packages/werkzeug/middleware/shared_data.py", line 220, in __call__
return self.app(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1439, in dispatch
odoo.registry(db).check_signaling()
File "/usr/lib/python3/dist-packages/odoo/__init__.py", line 104, in registry
return modules.registry.Registry(database_name)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 62, in __new__
return cls.new(db_name)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 417, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 313, in load_marked_modules
loaded, processed = load_module_graph(
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 191, in load_module_graph
model_names = registry.load(cr, package)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 222, in load
model = cls._build_model(self, cr)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 521, in _build_model
raise TypeError("Model %r does not exist in registry." % name)
TypeError: Model 'product.product' does not exist in registry. - - -