Skip to Content
Menu
This question has been flagged
3 Replies
9081 Views

2018-11-11 17:56:12,756 13245 ERROR odoo11 odoo.sql_db: bad query: b'SELECT "res_partner"."id" as "id","res_partner"."display_name" as "display_name","res_partner"."title" as "title","res_partner"."comment" as "comment","res_partner"."employee" as "employee","res_partner"."city" .....

ERROR: column res_partner.instructor does not exist

LINE 1: ..._deadline","res_partner"."supplier" as "supplier","res_partn...

                                                             ^


2018-11-11 17:56:13,558 13245 INFO odoo11 werkzeug: 127.0.0.1 - - [11/Nov/2018 17:56:13] "GET /web HTTP/1.1" 500 -

2018-11-11 17:56:13,607 13245 ERROR odoo11 werkzeug: Error on request:

Traceback (most recent call last):

  File "/home/stas/.local/lib/python3.5/site-packages/werkzeug/serving.py", line 205, in run_wsgi

    execute(self.server.app)

  File "/home/stas/.local/lib/python3.5/site-packages/werkzeug/serving.py", line 193, in execute

    application_iter = app(environ, start_response)

  File "/home/stas/odoo/odoo/service/server.py", line 252, in app

    return self.app(e, s)

  File "/home/stas/odoo/odoo/service/wsgi_server.py", line 166, in application

    return application_unproxied(environ, start_response)

  File "/home/stas/odoo/odoo/service/wsgi_server.py", line 154, in application_unproxied

    result = handler(environ, start_response)

  File "/home/stas/odoo/odoo/http.py", line 1318, in __call__

    return self.dispatch(environ, start_response)

  File "/home/stas/odoo/odoo/http.py", line 1292, in __call__

    return self.app(environ, start_wrapped)

  File "/home/stas/.local/lib/python3.5/site-packages/werkzeug/wsgi.py", line 599, in __call__

    return self.app(environ, start_response)

  File "/home/stas/odoo/odoo/http.py", line 1490, in dispatch

    result = ir_http._dispatch()

  File "/home/stas/odoo/odoo/addons/auth_signup/models/ir_http.py", line 19, in _dispatch

    return super(Http, cls)._dispatch()

  File "/home/stas/odoo/odoo/addons/web_editor/models/ir_http.py", line 22, in _dispatch

    return super(IrHttp, cls)._dispatch()

  File "/home/stas/odoo/odoo/addons/base/ir/ir_http.py", line 212, in _dispatch

    return cls._handle_exception(e)

  File "/home/stas/odoo/odoo/addons/base/ir/ir_http.py", line 182, in _handle_exception

    return request._handle_exception(exception)

  File "/home/stas/odoo/odoo/http.py", line 770, in _handle_exception

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

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

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

  File "/home/stas/odoo/odoo/tools/pycompat.py", line 87, in reraise

    raise value

  File "/home/stas/odoo/odoo/addons/base/ir/ir_http.py", line 208, in _dispatch

    result = request.dispatch()

  File "/home/stas/odoo/odoo/http.py", line 829, in dispatch

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

  File "/home/stas/odoo/odoo/http.py", line 342, in _call_function

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

  File "/home/stas/odoo/odoo/service/model.py", line 97, in wrapper

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

  File "/home/stas/odoo/odoo/http.py", line 335, in checked_call

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

  File "/home/stas/odoo/odoo/http.py", line 936, in __call__

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

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

    response = f(*args, **kw)

  File "/home/stas/odoo/odoo/addons/web/controllers/main.py", line 453, in web_client

    context = request.env['ir.http'].webclient_rendering_context()

  File "/home/stas/odoo/odoo/addons/web/models/ir_http.py", line 18, in webclient_rendering_context

    'session_info': json.dumps(self.session_info()),

  File "/home/stas/odoo/odoo/addons/web_tour/models/ir_http.py", line 12, in session_info

    result = super(Http, self).session_info()

  File "/home/stas/odoo/odoo/addons/web/models/ir_http.py", line 30, in session_info

    "user_context": request.session.get_context() if request.session.uid else {},

  File "/home/stas/odoo/odoo/http.py", line 1092, in get_context

    self.context = request.env['res.users'].context_get() or {}

  File "<decorator-gen-63>", line 2, in context_get

    

  File "/home/stas/odoo/odoo/tools/cache.py", line 89, in lookup

    value = d[key] = self.method(*args, **kwargs)

  File "/home/stas/odoo/odoo/addons/base/res/res_users.py", line 435, in context_get

    res = getattr(user, k) or False

  File "/home/stas/odoo/odoo/fields.py", line 941, in __get__

    self.determine_value(record)

  File "/home/stas/odoo/odoo/fields.py", line 1052, in determine_value

    self.compute_value(recs)

  File "/home/stas/odoo/odoo/fields.py", line 1008, in compute_value

    self._compute_value(records)

  File "/home/stas/odoo/odoo/fields.py", line 1001, in _compute_value

    self.compute(records)

  File "/home/stas/odoo/odoo/fields.py", line 589, in _compute_related

    record[self.name] = value[self.related_field.name]

  File "/home/stas/odoo/odoo/models.py", line 4758, in __getitem__

    return self._fields[key].__get__(self, type(self))

  File "/home/stas/odoo/odoo/fields.py", line 941, in __get__

    self.determine_value(record)

  File "/home/stas/odoo/odoo/fields.py", line 1042, in determine_value

    record._prefetch_field(self)

  File "/home/stas/odoo/odoo/models.py", line 2646, in _prefetch_field

    result = records.read([f.name for f in fs], load='_classic_write')

  File "/home/stas/odoo/odoo/models.py", line 2590, in read

    self._read_from_database(stored, inherited)

  File "/home/stas/odoo/odoo/models.py", line 2709, in _read_from_database

    cr.execute(query_str, params)

  File "/home/stas/odoo/odoo/sql_db.py", line 155, in wrapper

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

  File "/home/stas/odoo/odoo/sql_db.py", line 232, in execute

    res = self._obj.execute(query, params)

psycopg2.ProgrammingError: column res_partner.instructor does not exist

LINE 1: ..._deadline","res_partner"."supplier" as "supplier","res_partn...

                                                             ^

2018-11-11 17:56:13,674 13245 INFO odoo11 werkzeug: 127.0.0.1 - - [11/Nov/2018 17:56:13] "GET /favicon.ico HTTP/1.1" 404 -

Avatar
Discard

Please post your code as well.

Author

You answered today on my question about expand the model. At me setup odoo in Pycharm. I am restart server odoo everytime, when upgade the model. It's error arises for another reason. I am writing an example from the documentation https://www.odoo.com/documentation/11.0/howtos/backend.html#inheritance .You did not have similar breakdown?

Author

python.py

from odoo import models, fields

class Partner(models.Model):

_inherit='res.partner'

instructor=fields.Boolean('Instructor',defauls=False)

session_ids=fields.Many2many('openacademy.session',readonly=True)

model.py

class Session(models.Model):

_name='openacademy.session'

name=fields.Char(required=True,)

start_date=fields.Date()

duration=fields.Float(digits=(6,2),help='duration in days')

seats=fields.Integer(string='number of seats')

instructor_id=fields.Many2one('res.partner', ondelete='cascade',string='instructor')

course_id=fields.Many2one('openacademy.course', ondelete='cascade', string='Course',requires=True)

attendee_ids=fields.Many2many('res.partner',string='Attendees')

partner.xml

<odoo>

<record model="ir.ui.view" id="partner_insrtuctur_form_view">

<field name="name">partner.instructor</field>

<field name="model">res.partner</field>

<field name="inherit_id" ref="base.view_partner_form"/>

<field name="arch" type="xml">

<notebook position="inside">

<page string="Session">

<group>

<field name="instructor"/>

<field name="session_ids"/>

</group>

</page>

</notebook>

</field>

</record>

<record model="ir.actions.act_window" id="contact_list_action">

<field name="name">Contacts</field>

<field name="model">res.partner</field>

<field name="view_mode">tree,form</field>

</record>

<menuitem id="configuration_menu" name="Configuration"

parent="main_openacademy_menu"/>

<menuitem id ='contact_menu' name="Contacts"

parent="configuration_menu"/>

</odoo>

Please use concise and meaningful titles for your posts.

Try upgrading the module from terminal in such case: https://www.youtube.com/watch?v=ErzOia_A21w

Best Answer

There is a direct solution for this.

if you add any new fields to the res_company, res_partner, res_users tables you have to follow the following steps.

1) add new fields

2) open your custom module from the apps list

3) restart server, do immediate upgrade of custom module

Note : Here the problem is if you add any new fields to the res_company, res_partner, res_users tables every request it will check. If you upgrade after restart without any request it will work.


See: https://www.youtube.com/watch?v=-zXnlycSXog&list=PLqRRLx0cl0hoiTewSTzSQ3HJ-Vqhh43k0&index=12

Avatar
Discard

The problem is that the server doesn't restart at all. It returns an error and can not come up.

Best Answer

I had the same problem and doing as follow fix the issue:

  1. Stop your server
  2. Run this command at first:  python3 odoo-bin --update=purchase_request
  3. Reload your localhost in browser
  4. Upgrade your module
  5. Stop server again
  6. Now, using the old command (The command you use always) start server again
  7. Upgrade your module again
  8. Done.


Avatar
Discard
Best Answer

Hi,
please refer this question,
https://www.odoo.com/forum/help-1/question/field-doesn-t-exist-odoo-10-141803#answer-141826

From the question, you can get the idea about how to define a new field. In that question "announcer" and in your case  "instructor". you can check the .py files for "instructor" defined or not.
Regards,
Nikhilkrishnan

Avatar
Discard