Error on odoo 12 after installation and db creation - python-3.x

I have to start using odoo 12 on my job but I can't start using it, I have already 5 days searching on google to find an answer.
I would be very grateful if you could please help me, with some of your wisdom :)
After I install odoo on my computer and visit localhost:8069 for first time it asks me to create my database but after I do this it doesn't load the login page instead it gives me an 500 internal server error with this console log every time I refresh the page:
2020-10-12 18:31:41,068 21425 ERROR prueba werkzeug: Error on request:
Traceback (most recent call last):
File "/opt/odoo/odoo12/entvirt/lib/python3.8/site-packages/werkzeug/serving.py", line 205, in run_wsgi
execute(self.server.app)
File "/opt/odoo/odoo12/entvirt/lib/python3.8/site-packages/werkzeug/serving.py", line 193, in execute
application_iter = app(environ, start_response)
File "/opt/odoo/odoo12/entvirt/src/odoo/service/server.py", line 434, in app
return self.app(e, s)
File "/opt/odoo/odoo12/entvirt/src/odoo/service/wsgi_server.py", line 142, in application
return application_unproxied(environ, start_response)
File "/opt/odoo/odoo12/entvirt/src/odoo/service/wsgi_server.py", line 117, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 1320, in __call__
return self.dispatch(environ, start_response)
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 1293, in __call__
return self.app(environ, start_wrapped)
File "/opt/odoo/odoo12/entvirt/lib/python3.8/site-packages/werkzeug/wsgi.py", line 599, in __call__
return self.app(environ, start_response)
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 1488, in dispatch
result = ir_http._dispatch()
File "/opt/odoo/odoo12/entvirt/src/addons/web_editor/models/ir_http.py", line 22, in _dispatch
return super(IrHttp, cls)._dispatch()
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/ir_http.py", line 212, in _dispatch
return cls._handle_exception(e)
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/ir_http.py", line 182, in _handle_exception
return request._handle_exception(exception)
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 776, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 314, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo12/entvirt/src/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/ir_http.py", line 208, in _dispatch
result = request.dispatch()
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 835, in dispatch
r = self._call_function(**self.params)
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 346, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo12/entvirt/src/odoo/service/model.py", line 98, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 342, in checked_call
result.flatten()
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 1270, in flatten
self.response.append(self.render())
File "/opt/odoo/odoo12/entvirt/src/odoo/http.py", line 1263, in render
return env["ir.ui.view"].render_template(self.template, self.qcontext)
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/ir_ui_view.py", line 1324, in render_template
return self.browse(self.get_view_id(template)).render(values, engine)
File "/opt/odoo/odoo12/entvirt/src/addons/web_editor/models/ir_ui_view.py", line 29, in render
return super(IrUiView, self).render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/ir_ui_view.py", line 1333, in render
return self.env[engine].render(self.id, qcontext)
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/ir_qweb.py", line 59, in render
result = super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/qweb.py", line 275, in render
self.compile(template, options)(self, body.append, values or {})
File "<decorator-gen-54>", line 2, in compile
File "/opt/odoo/odoo12/entvirt/src/odoo/tools/cache.py", line 93, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/ir_qweb.py", line 114, in compile
return super(IrQWeb, self).compile(id_or_xml_id, options=options)
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/qweb.py", line 338, in compile
raise QWebException("Error when compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
odoo.addons.base.models.qweb.QWebException: Name node can't be used with 'None' constant
Traceback (most recent call last):
File "/opt/odoo/odoo12/entvirt/src/odoo/tools/cache.py", line 88, in lookup
r = d[key]
File "/opt/odoo/odoo12/entvirt/src/odoo/tools/func.py", line 69, in wrapper
return func(self, *args, **kwargs)
File "/opt/odoo/odoo12/entvirt/src/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: ('ir.qweb', <function IrQWeb.compile at 0x7f3b32b84280>, 173, ('en_US', None, None, None, None, None))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/odoo/odoo12/entvirt/src/odoo/addons/base/models/qweb.py", line 330, in compile
unsafe_eval(compile(astmod, '<template>', 'exec'), ns)
ValueError: Name node can't be used with 'None' constant
Error when compiling AST
ValueError: Name node can't be used with 'None' constant
Template: 173
Path: /templates/t/t/form/input[2]
Node: <input type="hidden" name="redirect" t-att-value="redirect"/> - - -

This is a problem with python 3.8.5.Try applying this fix https://github.com/odoo/odoo/pull/55305/commits/5baf0f2130b8d27d50aa60b54d68a5fc57b127a0

Related

Django serializers.save() does not use postgres

I have the following function that runs automatically with cronjob, it makes predictions based on an anomaly detection model and it saves the results to a postgres database:
def prediction_job():
"""
This job will run once every batch_minutes minutes to predict if the IPs appear in these batch_minutes minutes are normal or malicious
and save the results to postgres
"""
ip_estimator = IpStatePrediction()
predictions = ip_estimator.predict_ip_state()
predictions_dict_final = convert_dict_for_serializer(predictions)
serializer_result = PredictionsSerializer(data=predictions_dict_final)
if serializer_result.is_valid():
serializer_result.save()
else:
logger.debug("Error with data {}.".format(serializer_result.errors))
When I run it locally after running the commands python3 manage.py runserver and python3 migrate --database postgres, it saves the results to postgres.
However on production I am getting the following error, when the function is executed:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 413, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: unrecognized token: ":"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 108, in debug_sql
yield
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 413, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: unrecognized token: ":"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/rest_framework/decorators.py", line 50, in handler
return func(*args, **kwargs)
File "/anomaly_detection/views.py", line 23, in trigger_prediction_cronjob
prediction_job()
File "/anomaly_detection/access_logs_modeling.py", line 85, in prediction_job
serializer_result.save()
File "/usr/local/lib/python3.8/site-packages/rest_framework/serializers.py", line 205, in save
self.instance = self.create(validated_data)
File "/usr/local/lib/python3.8/site-packages/rest_framework/serializers.py", line 939, in create
instance = ModelClass._default_manager.create(**validated_data)
File "/usr/local/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 447, in create
obj.save(force_insert=True, using=self.db)
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 753, in save
self.save_base(using=using, force_insert=force_insert,
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 790, in save_base
updated = self._save_table(
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 895, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 933, in _do_insert
return manager._insert(
File "/usr/local/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1254, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
File "/usr/local/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 113, in debug_sql
sql = self.db.ops.last_executed_query(self.cursor, sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/sqlite3/operations.py", line 155, in last_executed_query
params = self._quote_params_for_last_executed_query(params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/sqlite3/operations.py", line 144, in _quote_params_for_last_executed_query
return cursor.execute(sql, params).fetchone()
sqlite3.InterfaceError: Error binding parameter 2 - probably unsupported type.

Error when using joblib in python with undetected chromedriver

when i use (self.links is an array of strings)
Parallel(n_jobs=2)(delayed(self.buybysize)(link) for link in self.links)
with this function
def buybysize(self, link):
browser = self.browser()
//other commented stuff
def browser(self):
options = uc.ChromeOptions()
options.user_data_dir = self.user_data_dir
options.add_argument(self.add_argument)
driver = uc.Chrome(options=options)
return driver
i get the error
oblib.externals.loky.process_executor._RemoteTraceback:
Traceback (most recent call last):
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 436, in _process_worker
r = call_item()
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 288, in __call__
return self.fn(*self.args, **self.kwargs)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 595, in __call__
return self.func(*args, **kwargs)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/parallel.py", line 262, in __call__
return [func(*args, **kwargs)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/parallel.py", line 262, in <listcomp>
return [func(*args, **kwargs)
File "/home/Me/PycharmProjects/zalando_buy/Zalando.py", line 91, in buybysize
browser = self.browser()
File "/home/Me/PycharmProjects/zalando_buy/Zalando.py", line 38, in browser
driver = uc.Chrome(options=options)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/undetected_chromedriver/__init__.py", line 388, in __init__
self.browser_pid = start_detached(
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/undetected_chromedriver/dprocess.py", line 30, in start_detached
multiprocessing.Process(
File "/usr/lib/python3.8/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/usr/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/backend/process.py", line 39, in _Popen
return Popen(process_obj)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/backend/popen_loky_posix.py", line 52, in __init__
self._launch(process_obj)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/backend/popen_loky_posix.py", line 157, in _launch
pid = fork_exec(cmd_python, self._fds, env=process_obj.env)
AttributeError: 'Process' object has no attribute 'env'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/Me/PycharmProjects/zalando_buy/Start.py", line 4, in <module>
class Start:
File "/home/Me/PycharmProjects/zalando_buy/Start.py", line 7, in Start
zalando.startshopping()
File "/home/Me/PycharmProjects/zalando_buy/Zalando.py", line 42, in startshopping
self.openlinks()
File "/home/Me/PycharmProjects/zalando_buy/Zalando.py", line 50, in openlinks
Parallel(n_jobs=2)(delayed(self.buybysize)(link) for link in self.links)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/parallel.py", line 1056, in __call__
self.retrieve()
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/parallel.py", line 935, in retrieve
self._output.extend(job.get(timeout=self.timeout))
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result
return future.result(timeout=timeout)
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 444, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
AttributeError: 'Process' object has no attribute 'env'
Process finished with exit code 1
For me it looks like there are instabilities because undetected chromedriver maybe uses multiprocessing already, but isnt there any way where i can open multiple Browsers with UC and process each iteration parallel?
Edit: i debugged and the error appears after trying to execute this line:
driver = uc.Chrome(options=options)

Odoo : Error on the second creation of project deadline

In Odoo framework, i've all projects done and created already, now im stack on projects deadline, when i want to create a deadline of projet, the first commit and operation passes successfully, but the second gives me this error below :
Traceback (most recent call last):
File "D:\Odoo 11.0\server\odoo\fields.py", line 936, in __get__
value = record.env.cache.get(record, self)
File "D:\Odoo 11.0\server\odoo\api.py", line 960, in get
value = self._data[field][record.id][key]
KeyError: <odoo.api.Environment object at 0x000000000B34F550>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Odoo 11.0\server\odoo\http.py", line 647, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "D:\Odoo 11.0\server\odoo\http.py", line 307, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "D:\Odoo 11.0\server\odoo\tools\pycompat.py", line 87, in reraise
raise value
File "D:\Odoo 11.0\server\odoo\http.py", line 689, in dispatch
result = self._call_function(**self.params)
File "D:\Odoo 11.0\server\odoo\http.py", line 339, in _call_function
return checked_call(self.db, *args, **kwargs)
File "D:\Odoo 11.0\server\odoo\service\model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "D:\Odoo 11.0\server\odoo\http.py", line 332, in checked_call
result = self.endpoint(*a, **kw)
File "D:\Odoo 11.0\server\odoo\http.py", line 933, in __call__
return self.method(*args, **kw)
File "D:\Odoo 11.0\server\odoo\http.py", line 512, in response_wrap
response = f(*args, **kw)
File "D:\Odoo 11.0\server\odoo\addons\web\controllers\main.py", line 872, in search_read
return self.do_search_read(model, fields, offset, limit, domain, sort)
File "D:\Odoo 11.0\server\odoo\addons\web\controllers\main.py", line 894, in do_search_read
offset=offset or 0, limit=limit or False, order=sort or False)
File "D:\Odoo 11.0\server\odoo\models.py", line 4169, in search_read
result = records.read(fields)
File "D:\Odoo 11.0\server\odoo\models.py", line 2535, in read
values[name] = field.convert_to_read(record[name], record, use_name_get)
File "D:\Odoo 11.0\server\odoo\models.py", line 4688, in __getitem__
return self._fields[key].__get__(self, type(self))
File "D:\Odoo 11.0\server\odoo\fields.py", line 940, in __get__
self.determine_value(record)
File "D:\Odoo 11.0\server\odoo\fields.py", line 1051, in determine_value
self.compute_value(recs)
File "D:\Odoo 11.0\server\odoo\fields.py", line 1007, in compute_value
self._compute_value(records)
File "D:\Odoo 11.0\server\odoo\fields.py", line 998, in _compute_value
getattr(records, self.compute)()
File "D:\Odoo 11.0\server\odoo\addons\dev\models\delais.py", line 24, in _delai_arret
domaine = ('project_ids', '=', self.project_ids).id
File "D:\Odoo 11.0\server\odoo\fields.py", line 934, in __get__
record.ensure_one()
File "D:\Odoo 11.0\server\odoo\models.py", line 4296, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: delais.delais(2, 18)
And this is the function which calculate the sum of missions number of each project, in this function i got the error. Please i didn't figure out where is the problem exactly, help me to get rid of this please, thank's for your support.
def _delai_arret(self):
domaine = ('project_ids', '=', self.project_ids).id
dict = self.env['mission.mission'].search_read([domaine], ['nbr_mission'])
# print(dict)
if not dict:
pass
else:
somme = 0
for key in dict:
# print(key['nbr_mission'])
somme = somme + key['nbr_mission'] / 30
# print('la somme est : {somme}')
self.delai_arr_mois = somme
# print(somme)

Airflow scheduler works normally, fails with -D

I have set up Airflow on an AWS EC2 server with Ubuntu 18.04, Python 3.6.9. The DB backend is a 5.7.26 MySQL, I am using a LocalExecutor. The setup is nothing more than:
apt-get install python3 python3-pip python3-venv libmysqlclient-dev
I install Airflow with pip3 install apache-airflow[mysql]==1.10.9, init DB connection, start the webserver and it works both normally and with -D. The scheduler, however, works only when run in the foreground. Trying to run it as a daemon fails with the following trace:
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 37, in <module> args.func(args)
File "/usr/local/lib/python3.6/dist-packages/airflow/utils/cli.py", line 75, in wrapper return f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/bin/cli.py", line 1032, in schedulerjob.run()
File "/usr/local/lib/python3.6/dist-packages/airflow/jobs/base_job.py", line 215, in run session.commit()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 1036, in commit self.transaction.commit()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 503, in commitself._prepare_impl()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 482, in _prepare_impl self.session.flush()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 2496, in flushself._flush(objects)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 2637, in _flush transaction.rollback(_capture_exception=True)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/langhelpers.py", line 69, in __exit__exc_value, with_traceback=exc_tb,
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 178, in raise_raise exception
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 2597, in _flush flush_context.execute()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute rec.execute(self)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute uow,
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/persistence.py", line 213, in save_obj) in _organize_states_for_save(base_mapper, states, uowtransaction):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/persistence.py", line 374, in _organize_states_for_save base_mapper, uowtransaction, states
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/persistence.py", line 1602, in _connections_for_states connection = uowtransaction.transaction.connection(base_mapper)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 313, in connection return self._connection_for_bind(bind, execution_options)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 420, in _connection_for_bind conn = self._parent._connection_for_bind(bind, execution_options)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 432, in _connection_for_bind conn = bind._contextual_connect()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 2251, in _contextual_connect self._wrap_pool_connect(self.pool.connect, None),
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 2285, in _wrap_pool_connect return fn()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool/base.py", line 363, in connect return _ConnectionFairy._checkout(self)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool/base.py", line 804, in _checkout result = pool._dialect.do_ping(fairy.connection)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 138, in do_pingdbapi_connection.ping(False)
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 546, in ping self._execute_command(COMMAND.COM_PING, "")
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 771, in _execute_command self._write_bytes(packet)
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 711, in _write_bytesself._sock.settimeout(self._write_timeout)
OSError: [Errno 9] Bad file descriptor
Exception ignored in: <function _ConnectionRecord.checkout.<locals>.<lambda> at 0x7f2eb025e268>
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool/base.py", line 503, in <lambda>
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool/base.py", line 702, in _finalize_fairy
File "/usr/lib/python3.6/logging/__init__.py", line 1337, in error
File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
File "/usr/lib/python3.6/logging/__init__.py", line 1071, in emit
File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open
NameError: name 'open' is not defined
I am trying to set up a server for semi-production purposes, so this is actually a blocker for me. I would be grateful for any advice.
EDIT
I tried using mysql-connector-python==8.0.18 and the scheduler did run as a daemon, but an attempt to open a dag failed with the following trace:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.6/dist-packages/flask_admin/base.py", line 69, in inner
return self._run_view(f, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/flask_admin/base.py", line 368, in _run_view
return fn(self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/flask_login/utils.py", line 258, in decorated_view
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/www/utils.py", line 384, in view_func
return f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/www/utils.py", line 290, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/utils/db.py", line 74, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/www/views.py", line 1559, in tree
start_date=min_date, end_date=base_date, session=session)
File "/usr/local/lib/python3.6/dist-packages/airflow/utils/db.py", line 70, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/models/dag.py", line 837, in get_task_instances
tis = tis.order_by(TaskInstance.execution_date).all()
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3233, in all
return list(self)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3389, in __iter__
return self._execute_and_instances(context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3414, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 982, in execute
return meth(self, multiparams, params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 293, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement
distilled_params,
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1250, in _execute_context
e, statement, parameters, cursor, context
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1478, in _handle_dbapi_exception
util.reraise(*exc_info)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 153, in reraise
raise value
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context
cursor, statement, parameters, context
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute
cursor.execute(statement, parameters)
File "/home/ubuntu/.local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 272, in execute
self._handle_result(result)
File "/home/ubuntu/.local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 163, in _handle_result
self._handle_resultset()
File "/home/ubuntu/.local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 651, in _handle_resultset
self._rows = self._cnx.get_rows()[0]
File "/home/ubuntu/.local/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 301, in get_rows
else self._cmysql.fetch_row()
SystemError: <built-in method fetch_row of _mysql_connector.MySQL object at 0x3cdaa10> returned a result with an error set
EDIT 2
What finally did work was using mysqlclient by specifying the SQLAlchemy connection string to begin with mysql+mysqldb. I am not giving this as an answer, because the initial problem persists.

Odoo 11 throws error on customer/partner listing after upgrade from odoo 10

I have recently upgraded an odoo 10 instance to odoo 11 using an open upgrade. After deleting projects module (apparently it cannot be properly migrated) and fixing some custom module I finally do have a running odoo 11 instance. However, whenever I try to click on customers/vendors odoo throws this error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 948, in __get__
value = record.env.cache.get(record, self)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 977, in get
value = self._data[key][field][record._ids[0]]
KeyError: 421
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 948, in __get__
value = record.env.cache.get(record, self)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 977, in get
value = self._data[key][field][record._ids[0]]
KeyError: 421
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 653, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 695, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 934, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 926, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 697, in call_kw
return call_kw_model(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 682, in call_kw_model
result = method(recs, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1296, in load_views
for [v_id, v_type] in views
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1296, in <dictcomp>
for [v_id, v_type] in views
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 374, in fields_view_get
res = super(MailThread, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1375, in fields_view_get
result = self._fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
File "/usr/lib/python3/dist-packages/odoo/addons/base/res/res_partner.py", line 318, in _fields_view_get
res = super(Partner, self)._fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1338, in _fields_view_get
root_view = View.browse(view_id).read_combined(['id', 'name', 'field_parent', 'type', 'model', 'arch'])
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 730, in read_combined
arch = self.apply_view_inheritance(arch_tree, root.id, self.model)
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 674, in apply_view_inheritance
sql_inherit = self.get_inheriting_views_arch(source_id, model)
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 498, in get_inheriting_views_arch
for view in views.sudo()
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 499, in <listcomp>
if not view.groups_id or (view.groups_id & user_groups)]
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 952, in __get__
self.determine_value(record)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1065, in determine_value
self.compute_value(recs)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1019, in compute_value
self._compute_value(records)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1010, in _compute_value
getattr(records, self.compute)()
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 260, in _compute_arch
view.arch = pycompat.to_text(arch_fs or view.arch_db)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 952, in __get__
self.determine_value(record)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1055, in determine_value
record._prefetch_field(self)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 2663, in _prefetch_field
result = records.read([f.name for f in fs], load='_classic_write')
File "/usr/lib/python3/dist-packages/odoo/models.py", line 2601, in read
self._read_from_database(stored, inherited)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 2744, in _read_from_database
values[index] = translate(ids[index], values[index])
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1344, in translate
return self.translate(src_trans.get, value)
File "/usr/lib/python3/dist-packages/odoo/tools/translate.py", line 306, in xml_translate
try:
File "/usr/lib/python3/dist-packages/odoo/tools/translate.py", line 284, in parse_xml
return etree.fromstring(bytes(text, encoding='utf-8'))
File "src/lxml/lxml.etree.pyx", line 3213, in lxml.etree.fromstring (src/lxml/lxml.etree.c:79003)
File "src/lxml/parser.pxi", line 1843, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:118275)
ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.
this seems pretty odd since whatever I read suggests to really change the odoo code itself, which I feel I should definitely not do. However, does anyone have a direction on where to look for this issue? I see that in translate.py there is an xml_parse without any encoding, but if this would be the root cause odoo itself shouldn't be working at all, but it works on a fresh instance, so the root cause must be something else then.
Thanks for any hint.
UPDATE: some further details
what i was trying to achieve:
I run an instance of odoo 10 and wante to upgrade it to odoo 11 using https://github.com/OCA/OpenUpgrade. This worked in the sense that all data was migrated and I had a working odoo 11 instance running. Before upgrading i stripped the odoo 10 instance to the bare minimum of modules to not infer any further conflicts/issues while upgrading. Si after upgrading i could log in and all looked good, except when i click on any view that is supposed to display customer data. There i get the error message as describe above. It seems there is some problem during upgrading that causes this issue. But i have no idea what this could be. I though i could export & delete all customers in the old instance, upgrade and import those, but this is of course not possible since there are documents/invoices attached to the customers. So this is not an option...
any ideas?

Resources