0
votes

I got an error:

ProgrammingError: relation "_unknown" does not exist
LINE 1: SELECT "_unknown".id FROM "_unknown" ORDER BY "_unknown"."id...

I can't make a selection of request_id Many2one field. For more information here is my code:

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>

In odoo my webpage I checked Technical-> Database Structure->Fields->field name:request_id. I found that Object Relation is _unknown. In my code I see a relation: request_id = fields.Many2one('purchase.request', string='Purchase request', track_visibility='onchange')

So I don't know what is wrong.

Maybe I need some dependences at my openerp.py file.

I added product dependence at openerp.py file and now I have another error:

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'
1
Are you using this module for 'purchase.request' --> odoo.com/apps/modules/9.0/purchase_request ?Vishnu VaNnErI
Yes, this one. And I extended it.fueggit
add it in dependsVishnu VaNnErI
I added but ProgrammingError: relation "_unknown" does not exist with request_id field.fueggit

1 Answers

3
votes

There is no inbuilt app which installs 'purchase.request', i think you are inheriting a model from customized module.

If it then add The module name in openerp.py : depends

literally i found a module in https://www.odoo.com/apps/modules/9.0/purchase_request/

If you are using this then add the module name in your __openerp_.py file

{
    'name': 'My Purchase',
    'description': '...',
    'author': 'me',
    'depends': ['purchase','purchase_request'],
    'application': True,
}