我收到了一个错误:
ProgrammingError: relation "_unknown" does not exist
LINE 1: SELECT "_unknown".id FROM "_unknown" ORDER BY "_unknown"."id...
我无法选择request_id Many2one字段。有关详细信息,请参阅我的代码:
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
request_id = fields.Many2one('purchase.request', string='Purchase request', track_visibility='onchange')
OpenERP的的.py
{
'name': 'My Purchase',
'description': '...',
'author': 'me',
'depends': ['purchase'],
'application': True,
}
xml part:
<group>
<field name="request_id"/>
<field name="origin" attrs="{'invisible': [('origin','=',False)]}"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
</group>
在我的网页上,我检查了技术 - >数据库结构 - &gt;字段 - &gt;字段名称:request_id。我发现Object Relation is _unknown
。在我的代码中,我看到了一个关系:
request_id = fields.Many2one('purchase.request'
,string =&#39;购买请求&#39;,track_visibility =&#39; onchange&#39;)
所以我不知道出了什么问题。
也许我的 openerp .py文件需要一些依赖。
我在 openerp .py文件中添加了产品相关性,现在我又出现了另一个错误:
2017-03-07 06:56:00,708 7655 ERROR test_test werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/opt/odoo/openerp/service/server.py", line 245, in app
return self.app(e, s)
File "/opt/odoo/openerp/service/wsgi_server.py", line 184, in application
return application_unproxied(environ, start_response)
File "/opt/odoo/openerp/service/wsgi_server.py", line 170, in application_unproxied
result = handler(environ, start_response)
File "/opt/odoo/openerp/http.py", line 1488, in __call__
return self.dispatch(environ, start_response)
File "/opt/odoo/openerp/http.py", line 1462, in __call__
return self.app(environ, start_wrapped)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__
return self.app(environ, start_response)
File "/opt/odoo/openerp/http.py", line 1637, in dispatch
ir_http = request.registry['ir.http']
File "/opt/odoo/openerp/http.py", line 360, in registry
return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None
File "/opt/odoo/openerp/modules/registry.py", line 354, in get
update_module)
File "/opt/odoo/openerp/modules/registry.py", line 385, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/openerp/modules/loading.py", line 334, in load_modules
force, status, report, loaded_modules, update_module)
File "/opt/odoo/openerp/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/odoo/openerp/modules/loading.py", line 136, in load_module_graph
registry.setup_models(cr, partial=True)
File "/opt/odoo/openerp/modules/registry.py", line 199, in setup_models
model._setup_fields(cr, SUPERUSER_ID)
File "/opt/odoo/openerp/api.py", line 238, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/api.py", line 342, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo/openerp/models.py", line 3045, in _setup_fields
field.setup_full(self)
File "/opt/odoo/openerp/fields.py", line 478, in setup_full
self._setup_related_full(model)
File "/opt/odoo/openerp/fields.py", line 516, in _setup_related_full
field.setup_full(target)
File "/opt/odoo/openerp/fields.py", line 476, in setup_full
self._setup_regular_full(model)
File "/opt/odoo/openerp/fields.py", line 1847, in _setup_regular_full
invf = comodel._fields[self.inverse_name]
KeyError: 'request_id'
答案 0 :(得分:3)
没有内置应用程序可以安装&purchase ;request&#39;,我认为你是从自定义模块继承模型。
如果是,则在 openerp .py:depends
中添加模块名称字面上我在https://www.odoo.com/apps/modules/9.0/purchase_request/
中找到了一个模块如果您使用此项,请在__openerp_.py文件中添加模块名称
{
'name': 'My Purchase',
'description': '...',
'author': 'me',
'depends': ['purchase','purchase_request'],
'application': True,
}