nikhil96widhani / AI_DjangoPOS

Repo for a Smart Django POS system with artificial Intelligence features
8 stars 5 forks source link

Inventory> add stock - error when change price of prev product and add new product by scanning #127

Open nikhil96widhani opened 2 years ago

nikhil96widhani commented 2 years ago

Error txt

Internal Server Error: /api/add-bill-item/

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 179, 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 "/code/api/inventory_views.py", line 290, in add_bill_item

variation = ProductVariation.objects.get(product=product_code)

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 429, in get

raise self.model.DoesNotExist(

inventory.models.ProductVariation.DoesNotExist: ProductVariation matching query does not exist.

[05/Jan/2022 19:03:28] "POST /api/add-bill-item/ HTTP/1.1" 500 100084

nikhil96widhani commented 2 years ago

Issue was due to old captured value from input fields which was added to barcode value. to fix this :-

Added 1 sec event listener to clear barcode value inside jquery.pos.js