This question has been flagged
8 Replies
6239 Views

Yesterday all of a sudden my database collapsed. At first I thought it was a caching issue when switching between databases, but it turned out to be another problem.


I backed up the database and moved it to a localhost to be SURE it wasn't a caching issue, but still no result. Excerpt of the error from odoo.log and postgres.log are below.

I've tried setting the state of website to uninstalled through the database, in hopes of fixing it, but no result whatshowever.  Also, tried changing locale, but it seems to go wrong in building the query. It expects a boolean where it returns an integer. 

Please help me on this issue, I've been breaking my head on it for about 1.5 days now, I'm sure its a minor issue I've overlooked somewhere.

Odoo.log


2016-10-28 09:50:44,295 2715 INFO fixme werkzeug: 192.168.10.181 - - [28/Oct/2016 09:50:44] "GET /web?db=fixme HTTP/1.1" 303 -2016-10-28 09:50:44,311 2715 INFO fixme odoo.sql_db: bad query: SELECT MAX(CASE WHEN perm_read THEN 1 ELSE 0 END)                              FROM ir_model_access a                              JOIN ir_model m ON (m.id = a.model_id)                              JOIN res_groups_users_rel gu ON (gu.gid = a.group_id)                             WHERE m.model = 'website'                               AND gu.uid = false                               AND a.active IS TRUE2016-10-28 09:50:44,322 2715 INFO fixme werkzeug: 192.168.10.181 - - [28/Oct/2016 09:50:44] "GET /web/login HTTP/1.1" 500 -2016-10-28 09:50:44,347 2715 ERROR fixme werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi    execute(self.server.app)  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute    application_iter = app(environ, start_response)  File "/usr/lib/python2.7/dist-packages/odoo/service/server.py", line 246, in app    return self.app(e, s)  File "/usr/lib/python2.7/dist-packages/odoo/service/wsgi_server.py", line 184, in application    return application_unproxied(environ, start_response)  File "/usr/lib/python2.7/dist-packages/odoo/service/wsgi_server.py", line 170, in application_unproxied    result = handler(environ, start_response)  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1306, in __call__    return self.dispatch(environ, start_response)  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1280, in __call__    return self.app(environ, start_wrapped)  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 579, in __call__    return self.app(environ, start_response)  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1471, in dispatch    result = ir_http._dispatch()  File "/usr/lib/python2.7/dist-packages/odoo/addons/website_sale/models/ir_http.py", line 15, in _dispatch    return super(IrHttp, cls)._dispatch()  File "/usr/lib/python2.7/dist-packages/odoo/addons/website/models/ir_http.py", line 166, in _dispatch    langs = [lg[0] for lg in request.website.get_languages()]  File "/usr/lib/python2.7/dist-packages/odoo/addons/website/models/website.py", line 349, in get_languages    return self._get_languages()  File "<string>", line 2, in _get_languages
  File "/usr/lib/python2.7/dist-packages/odoo/tools/cache.py", line 87, in lookup    value = d[key] = self.method(*args, **kwargs)  File "/usr/lib/python2.7/dist-packages/odoo/addons/website/models/website.py", line 353, in _get_languages    return [(lg.code, lg.name) for lg in self.language_ids]  File "/usr/lib/python2.7/dist-packages/odoo/fields.py", line 860, in __get__    self.determine_value(record)  File "/usr/lib/python2.7/dist-packages/odoo/fields.py", line 962, in determine_value    record._prefetch_field(self)  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 3051, in _prefetch_field    result = records.read([f.name for f in fs], load='_classic_write')  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 2972, in read    self.check_access_rights('read')  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 3270, in check_access_rights    return self.env['ir.model.access'].check(self._name, operation, raise_exception)  File "<string>", line 2, in check
  File "/usr/lib/python2.7/dist-packages/odoo/tools/cache.py", line 87, in lookup    value = d[key] = self.method(*args, **kwargs)  File "/usr/lib/python2.7/dist-packages/odoo/addons/base/ir/ir_model.py", line 840, in check    (model_name, self._uid,))  File "/usr/lib/python2.7/dist-packages/odoo/sql_db.py", line 141, in wrapper    return f(self, *args, **kwargs)  File "/usr/lib/python2.7/dist-packages/odoo/sql_db.py", line 218, in execute    res = self._obj.execute(query, params)ProgrammingError: operator does not exist: integer = booleanLINE 6:                                AND gu.uid = false                                                  ^HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.


Postgres.log


2016-10-28 11:50:37 CEST STATEMENT:  SELECT MAX(CASE WHEN perm_read THEN 1 ELSE 0 END)	                              FROM ir_model_access a	                              JOIN ir_model m ON (m.id = a.model_id)	                              JOIN res_groups_users_rel gu ON (gu.gid = a.group_id)	                             WHERE m.model = 'website'	                               AND gu.uid = false	                               AND a.active IS TRUE2016-10-28 11:50:44 CEST ERROR:  operator does not exist: integer = boolean at character 354
Avatar
Discard

Could you please be so kind and reformat your post?

Yeah, just tried that. but for some reason I keep getting a 403 error when submitting the reformatted post.

So pasted at codesnippet http://paste.ofcode.org/3a7pvjtsDJRsgWMbNjQaJus

Best Answer

Is anyone find the solution?

Avatar
Discard
Best Answer

Because website user (user_id) is public user that created as user on users list. 

So if you removed public user from users list, website will be stopped and give this error.

Avatar
Discard
Best Answer

After quite a bit of investigation I've traced the issue to this line: https://github.com/odoo/odoo/blob/10.0/addons/website/models/ir_http.py#L65


Apparently the website object has a non-required field user_id which should point to the default Public User. For some undiscovered reason that field can set to an empty value and then the aforementioned line sets the uid on the request to False.

One would have to update the user_id value in the database with the daabase id of the portal user to restore normal function, in the meantime I will also make a PR to check the value of user_id on the website or make user_id required to avoid this in the future.

Hope this helps.


[LATER EDIT]

Here is the PR in question: https://github.com/odoo/odoo/pull/21997

Avatar
Discard
Best Answer

Did anyone have a solution for this?

Avatar
Discard
Author Best Answer

Just tried repairing the database with the -d parameter, still same error. Thanks for the suggestion.

Can't reply to answers yet due to lack of karma

Avatar
Discard
Best Answer

You can update you database,using parameter '-D YourDatabaseName -U all‘ when you start odoo.

Try this.


Avatar
Discard