odoo8+pgpool2 ParseError: "Incorrect padding - base64

i try to connect my odoo8 to my pgpool.
I write into the odoo-server.conf corrects paramters to connect with my pgpool and it work fine..
but, when I create a new database trought odoo, it begins to create tables, index, .. but give me next error:
Traceback (most recent call last):
File "/opt/odoo/odoo-server/openerp/http.py", line 537, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo-server/openerp/http.py", line 574, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo-server/openerp/http.py", line 311, in _call_function
return self.endpoint(*args, **kwargs)
File "/opt/odoo/odoo-server/openerp/http.py", line 803, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo-server/openerp/http.py", line 403, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 705, in create
request.session.authenticate(params['db_name'], 'admin', params['create_admin_pwd'])
File "/opt/odoo/odoo-server/openerp/http.py", line 956, in authenticate
uid = dispatch_rpc('common', 'authenticate', [db, login, password, env])
File "/opt/odoo/odoo-server/openerp/http.py", line 115, in dispatch_rpc
result = dispatch(method, params)
File "/opt/odoo/odoo-server/openerp/service/common.py", line 26, in dispatch
return fn(*params)
File "/opt/odoo/odoo-server/openerp/service/common.py", line 37, in exp_authenticate
res_users = openerp.registry(db)['res.users']
File "/opt/odoo/odoo-server/openerp/__init__.py", line 68, in registry
return modules.registry.RegistryManager.get(database_name)
File "/opt/odoo/odoo-server/openerp/modules/registry.py", line 339, in get
update_module)
File "/opt/odoo/odoo-server/openerp/modules/registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 297, in load_modules
loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=update_module, report=report)
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 176, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 118, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/opt/odoo/odoo-server/openerp/tools/convert.py", line 900, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/opt/odoo/odoo-server/openerp/tools/convert.py", line 986, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/opt/odoo/odoo-server/openerp/tools/convert.py", line 852, in parse
self._tags[rec.tag](self.cr, rec, n, mode=mode)
File "/opt/odoo/odoo-server/openerp/tools/convert.py", line 762, in _tag_record
id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 1064, in _update
res_id = model_obj.create(cr, uid, values, context=context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_users.py", line 863, in create
return super(users_view, self).create(cr, uid, values, context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_users.py", line 661, in create
user_id = super(users_implied, self).create(cr, uid, values, context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_users.py", line 332, in create
user_id = super(res_users, self).create(cr, uid, vals, context=context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 372, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 4093, in create
record = self.browse(self._create(old_vals))
File "/opt/odoo/odoo-server/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 508, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 4151, in _create
self.pool[table].write(cr, user, [record_id], tocreate[table], context=context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 399, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_partner.py", line 564, in write
result = super(res_partner, self).write(vals)
File "/opt/odoo/odoo-server/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 3788, in write
self._write(old_vals)
File "/opt/odoo/odoo-server/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 592, in new_api
result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 4036, in _write
cr, user, todo, fields_to_recompute, context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 4409, in _store_set_values
result = self._columns[val[0]].get(cr, self, ids, val, SUPERUSER_ID, context=context)
File "/opt/odoo/odoo-server/openerp/osv/fields.py", line 1460, in get
result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 399, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_partner.py", line 191, in _get_image
return dict((p.id, tools.image_get_resized_images(p.image)) for p in self)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_partner.py", line 191, in <genexpr>
return dict((p.id, tools.image_get_resized_images(p.image)) for p in self)
File "/opt/odoo/odoo-server/openerp/tools/image.py", line 223, in image_get_resized_images
return_dict[medium_name] = image_resize_image_medium(base64_source, avoid_if_small=avoid_resize_medium)
File "/opt/odoo/odoo-server/openerp/tools/image.py", line 161, in image_resize_image_medium
return image_resize_image(base64_source, size, encoding, filetype, avoid_if_small)
File "/opt/odoo/odoo-server/openerp/tools/image.py", line 70, in image_resize_image
image_stream = StringIO.StringIO(base64_source.decode(encoding))
File "/usr/lib/python2.7/encodings/base64_codec.py", line 42, in base64_decode
output = base64.decodestring(input)
File "/usr/lib/python2.7/base64.py", line 321, in decodestring
return binascii.a2b_base64(s)
ParseError: "Incorrect padding" while parsing /opt/odoo/odoo-server/openerp/addons/base/base_data.xml:128, near
<record id="public_user" model="res.users">
<field name="name">Public user</field>
<field name="login">public</field>
<field name="password"/>
<!-- Avoid auto-including this demo user in any default group -->
<field name="groups_id" eval="[(6,0,[ref('base.group_public')])]"/>
<field name="image" type="base64" file="base/static/img/public_user-image.png"/>
<field name="partner_id" ref="public_partner"/>
<field name="active" eval="False"/>
</record>
it creates some tables, index..., so it isn't a permissions error...
In odoo9 i have not this error and work fine ( but i need odoo8 version..)
thanks

Related

Kernel issues on jupyter

Error Starting Kernel
Traceback (most recent call last):
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/tornado/web.py", line 1713, in _execute
result = await result
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/tornado/gen.py", line 776, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/notebook/services/sessions/handlers.py", line 72, in post
type=mtype))
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/tornado/gen.py", line 769, in run
value = future.result()
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/tornado/gen.py", line 776, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/tornado/gen.py", line 769, in run
value = future.result()
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/tornado/gen.py", line 776, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/tornado/gen.py", line 769, in run
value = future.result()
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/tornado/gen.py", line 234, in wrapper
yielded = ctx_run(next, result)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/utils.py", line 30, in wrapped
raise e
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/utils.py", line 27, in wrapped
return loop.run_until_complete(future)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/nest_asyncio.py", line 90, in run_until_complete
return f.result()
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/asyncio/futures.py", line 178, in result
raise self._exception
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/asyncio/tasks.py", line 223, in __step
result = coro.send(None)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/multikernelmanager.py", line 214, in _async_start_kernel
starter = ensure_async(km.start_kernel(**kwargs))
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/utils.py", line 30, in wrapped
raise e
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/utils.py", line 27, in wrapped
return loop.run_until_complete(future)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/nest_asyncio.py", line 90, in run_until_complete
return f.result()
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/asyncio/futures.py", line 178, in result
raise self._exception
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/asyncio/tasks.py", line 223, in __step
result = coro.send(None)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/manager.py", line 90, in wrapper
raise e
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/manager.py", line 82, in wrapper
out = await method(self, *args, **kwargs)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/manager.py", line 394, in _async_start_kernel
await ensure_async(self._launch_kernel(kernel_cmd, **kw))
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/utils.py", line 30, in wrapped
raise e
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/utils.py", line 27, in wrapped
return loop.run_until_complete(future)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/nest_asyncio.py", line 90, in run_until_complete
return f.result()
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/asyncio/futures.py", line 178, in result
raise self._exception
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/asyncio/tasks.py", line 223, in __step
result = coro.send(None)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/manager.py", line 311, in _async_launch_kernel
connection_info = await self.provisioner.launch_kernel(kernel_cmd, **kw)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/provisioning/local_provisioner.py", line 204, in launch_kernel
self.process = launch_kernel(cmd, **scrubbed_kwargs)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/launcher.py", line 170, in launch_kernel
raise ex
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/site-packages/jupyter_client/launcher.py", line 158, in launch_kernel
proc = Popen(cmd, **kwargs)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/root/anaconda3/envs/TensorPy36/lib/python3.7/subprocess.py", line 1453, in _execute_child
restore_signals, start_new_session, preexec_fn)
BlockingIOError: [Errno 11] Resource temporarily unavailable
Permanent solution for this error

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.

Getting ProgrammingError at ... using Heroku

I made some changes to my models.py file and now I return this error when I try to access my heroku app's admin page:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
The above exception (column testingland_mapcafes.cafe_image_url does not exist
LINE 1: ...s"."venue_type", "testingland_mapcafes"."source", "testingla...
^
) was the direct cause of the following exception:
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/options.py", line 622, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/sites.py", line 236, in inner
return view(request, *args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1828, in changelist_view
'selection_note': _('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)},
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 262, in __len__
self._fetch_all()
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 1354, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1202, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /admin/testingland/mapcafes/
Exception Value: column testingland_mapcafes.cafe_image_url does not exist
LINE 1: ...s"."venue_type", "testingland_mapcafes"."source", "testingla...
I have tried running heroku run python3 manage.py migrate and get No migrations to apply.
I deleted my migrations cache folder and also manually dropped a column from my Heroku postgres CLI to try and fix things but fear I only made it worse.
Here is the relevant models.py
class mapCafes(models.Model):
id = models.BigAutoField(primary_key=True)
cafe_name = models.CharField(max_length=200)
cafe_address = models.CharField(max_length=200)
cafe_long = models.FloatField()
cafe_lat = models.FloatField()
geolocation = models.PointField(geography=True, blank=True, null=True)
venue_type = models.CharField(max_length=200)
source = models.CharField(max_length=200)
cafe_image_url = models.CharField(max_length=200, null=False)
When I manually check the table through the Heroku DATABASE CLi the cafe_image_url column is not there - suggesting the migration isn't occurring correctly.
FWIW - everything works correctly on my local server.

'super' object has no attribute 'set_context'

I upgrade Django version from 1.11 to 3.2 and upgrade the installed python.
I am facing an error at this line
super().set_context(serializer_field)
Below is the Full class code.
class UniqueForProjectValidator(UniqueValidator):
def set_context(self, serializer_field):
super().set_context(serializer_field)
self.project = serializer_field.parent.context['project']
def filter_queryset(self, value, queryset):
queryset = queryset.filter(project=self.project)
return super().filter_queryset(value, queryset)
Here is the Error
Traceback (most recent call last):
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\viewsets.py", line 125, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
raise exc
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\mixins.py", line 82, in partial_update
return self.update(request, *args, **kwargs)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\mixins.py", line 67, in update
serializer.is_valid(raise_exception=True)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\serializers.py", line 220, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\serializers.py", line 419, in run_validation
value = self.to_internal_value(data)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\serializers.py", line 476, in to_internal_value
validated_value = field.run_validation(primitive_value)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\fields.py", line 799, in run_validation
return super().run_validation(data)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\fields.py", line 569, in run_validation
self.run_validators(value)
File "C:\Users\arauf\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\fields.py", line 587, in run_validators
validator.set_context(self)
File "C:\Users\arauf\Desktop\innerzone\NewCode\InnerZone-Backend\core\utils.py", line 213, in set_context
super().set_context(serializer_field)
AttributeError: 'super' object has no attribute 'set_context'
It seems you have possibly upgraded Django Rest Framework as well however on Django Rest Frameworks GitHub page, the method set_context does not exist. So your error is telling you, the method set_context on the parent class UniqueValidator does not exist.
See their GitHub page here.

migrate over odoo v10 to odoo v13 getting error in Onchange func

Fields definition:
time_task_ids = fields.One2many('timesheet.timesheet','timesheet_id','Timesheet')
timesheet_id = fields.Many2one('timesheet.timesheet', 'Timesheet', compute='_compute_timesheet_id')
Transient_model_name = 'timesheet.data'
Method that could cause this problem:
#api.onchange('created_by','created_date')
def on_change_created_by(self):
# list the task in timesheet based on user
task_ids = self.env['prj.task'].search([('task_assigned_to','=',self.created_by.id),
('state','=','ongoing'),('child_ids','=',False)])
task_list = []
for task in task_ids:
timesheet = self.env['timesheet.timesheet'].search([('task_ids', '=', task.id)])
tot_time = 0
for i in timesheet:
tot_time += i.duration
tot_duration = task.task_planned_hours - tot_time
vals = {
'task_ids': task.id,
'created_date': self.created_date,
'created_by': self.created_by.id,
'prj_project_id':task.prj_project_id.id,
'planned_hour': task.task_planned_hours,
'task_deadline_date': task.task_deadline_date,
'balance_hour': tot_duration,
'ref_parent_id': task.task_assigned_to.parent_id.id,
}
task_list.append((0, 0, vals))
self.time_task_ids = task_list
Error Traceback :
2020-02-24 09:29:28,448 10954 ERROR new_db3 odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/home/guru/Documents/odoo-13/odoo/http.py", line 619, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/guru/Documents/odoo-13/odoo/http.py", line 309, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/home/guru/Documents/odoo-13/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/home/guru/Documents/odoo-13/odoo/http.py", line 664, in dispatch
result = self._call_function(**self.params)
File "/home/guru/Documents/odoo-13/odoo/http.py", line 345, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/guru/Documents/odoo-13/odoo/service/model.py", line 93, in wrapper
return f(dbname, *args, **kwargs)
File "/home/guru/Documents/odoo-13/odoo/http.py", line 338, in checked_call
result = self.endpoint(*a, **kw)
File "/home/guru/Documents/odoo-13/odoo/http.py", line 910, in __call__
return self.method(*args, **kw)
File "/home/guru/Documents/odoo-13/odoo/http.py", line 510, in response_wrap
response = f(*args, **kw)
File "/home/guru/Documents/odoo-13/addons/web/controllers/main.py", line 1320, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/guru/Documents/odoo-13/addons/web/controllers/main.py", line 1312, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/guru/Documents/odoo-13/odoo/api.py", line 395, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/guru/Documents/odoo-13/odoo/api.py", line 382, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/guru/Documents/odoo-13/odoo/models.py", line 6056, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "/home/guru/Documents/odoo-13/odoo/models.py", line 5857, in _onchange_eval
method_res = method(self)
File "/home/guru/Documents/odoo-13/addons/ajax_timesheet/wizard/wizard_timesheet.py", line 98, in on_change_created_by
self.time_task_ids = task_list
File "/home/guru/Documents/odoo-13/odoo/fields.py", line 1068, in __set__
self.write(new_records, value)
File "/home/guru/Documents/odoo-13/odoo/fields.py", line 2758, in write
return self.write_batch([(records, value)])
File "/home/guru/Documents/odoo-13/odoo/fields.py", line 2782, in write_batch
return self.write_new(records_commands_list)
File "/home/guru/Documents/odoo-13/odoo/fields.py", line 3002, in write_new
line[inverse] = record
File "/home/guru/Documents/odoo-13/odoo/models.py", line 5598, in __setitem__
return self._fields[key].__set__(self, value)
File "/home/guru/Documents/odoo-13/odoo/fields.py", line 1068, in __set__
self.write(new_records, value)
File "/home/guru/Documents/odoo-13/odoo/fields.py", line 2467, in write
cache_value = self.convert_to_cache(value, records)
File "/home/guru/Documents/odoo-13/odoo/fields.py", line 2400, in convert_to_cache
raise ValueError("Wrong value for %s: %r" % (self, value))
ValueError: Wrong value for timesheet.timesheet.timesheet_id: timesheet.data(<NewId 0x7fba579107b8>,)
give me a solution to solve this error.
error occurs in one2many to list assignment

Resources