You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you attempt to add a stock item to a stock take that is already included in the stock take, you get an exception instead of an informative error message.
Traceback:
Internal Server Error: /tillweb/devonshire/stocktake/88/
IntegrityError at /tillweb/devonshire/stocktake/88/
(psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "stocktake_snapshots_pkey"
DETAIL: Key (stocktake_id, stock_id)=(88, 34428) already exists.
[SQL: INSERT INTO stocktake_snapshots (stocktake_id, stock_id, qty, displayqty, newdisplayqty, finishcode) VALUES (%(stocktake_id)s, %(stock_id)s, %(qty)s, %(displayqty)s, %(newdisplayqty)s, %(finishcode)s)]
[parameters: {'stocktake_id': 88, 'stock_id': 34428, 'qty': Decimal('72.0'), 'displayqty': None, 'newdisplayqty': None, 'finishcode': None}]
(Background on this error at: https://sqlalche.me/e/14/gkpj)
Request Method: POST
Request URL: https://www.individualpubs.co.uk/tillweb/devonshire/stocktake/88/
Django Version: 4.2.16
Python Executable: /usr/bin/uwsgi-core
Python Version: 3.8.10
Python Path: ['/home/ipladmin/live/quicktill/', '.', '', '/home/ipladmin/live/ipladmin/~/live/ipladmin', '/home/ipladmin/live/ipladmin/~/live/quicktill', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/ipladmin/live/venv/lib/python3.8/site-packages', '/home/ipladmin/live/venv/lib/python3.8/site-packages/odf', '/home/ipladmin/live/venv/lib/python3.8/site-packages/odf', '/home/ipladmin/live/venv/lib/python3.8/site-packages/odf', '/home/ipladmin/live/venv/lib/python3.8/site-packages/odf', '/home/ipladmin/live/venv/lib/python3.8/site-packages/odf', '/home/ipladmin/live/venv/lib/python3.8/site-packages/odf', '/home/ipladmin/live/venv/lib/python3.8/site-packages/odf']
Server time: Tue, 26 Nov 2024 10:37:40 +0000
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.staticfiles',
'django_bootstrap_breadcrumbs',
'sorl.thumbnail',
'widget_tweaks',
'maintenance.apps.MaintenanceConfig',
'payroll.apps.PayrollConfig',
'schedule.apps.ScheduleConfig',
'mail.apps.MailConfig',
'fcgiauth.apps.FCGIAuthConfig',
'markup',
'magiclinks',
'photologue',
'sortedm2m',
'pubs.apps.PubsConfig',
'staffinfo.apps.StaffInfoConfig',
'safety.apps.SafetyConfig',
'training.apps.TrainingConfig',
'notify.apps.NotifyConfig',
'pages.apps.PagesConfig',
'quicktill.tillweb.apps.TillWebConfig']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'pages.middleware.PagesFallbackMiddleware')
Traceback (most recent call last):
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
self.dialect.do_execute(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
The above exception (duplicate key value violates unique constraint "stocktake_snapshots_pkey"
DETAIL: Key (stocktake_id, stock_id)=(88, 34428) already exists.
) was the direct cause of the following exception:
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
return view_func(request, *args, **kwargs)
File "/home/ipladmin/live/quicktill/quicktill/tillweb/views.py", line 283, in new_view
result = view(request, info, *args, **kwargs)
File "/home/ipladmin/live/quicktill/quicktill/tillweb/stocktake.py", line 96, in stocktake
return stocktake_in_progress(request, info, stocktake)
File "/home/ipladmin/live/quicktill/quicktill/tillweb/stocktake.py", line 412, in stocktake_in_progress
td.s.commit()
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1454, in commit
self._transaction.commit(_to_root=self.future)
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 832, in commit
self._prepare_impl()
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 811, in _prepare_impl
self.session.flush()
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 3449, in flush
self._flush(objects)
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 3589, in _flush
transaction.rollback(_capture_exception=True)
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
compat.raise_(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 3549, in _flush
flush_context.execute()
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute
rec.execute(self)
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 630, in execute
util.preloaded.orm_persistence.save_obj(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj
_emit_insert_statements(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 1097, in _emit_insert_statements
c = connection._execute_20(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
return connection._execute_clauseelement(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
ret = self._execute_context(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1953, in _execute_context
self._handle_dbapi_exception(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2134, in _handle_dbapi_exception
util.raise_(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
self.dialect.do_execute(
File "/home/ipladmin/live/venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
Exception Type: IntegrityError at /tillweb/devonshire/stocktake/88/
Exception Value: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "stocktake_snapshots_pkey"
DETAIL: Key (stocktake_id, stock_id)=(88, 34428) already exists.
[SQL: INSERT INTO stocktake_snapshots (stocktake_id, stock_id, qty, displayqty, newdisplayqty, finishcode) VALUES (%(stocktake_id)s, %(stock_id)s, %(qty)s, %(displayqty)s, %(newdisplayqty)s, %(finishcode)s)]
[parameters: {'stocktake_id': 88, 'stock_id': 34428, 'qty': Decimal('72.0'), 'displayqty': None, 'newdisplayqty': None, 'finishcode': None}]
(Background on this error at: https://sqlalche.me/e/14/gkpj)
Raised during: quicktill.tillweb.views.new_view
The text was updated successfully, but these errors were encountered:
When you attempt to add a stock item to a stock take that is already included in the stock take, you get an exception instead of an informative error message.
Traceback:
The text was updated successfully, but these errors were encountered: