inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.24k stars 765 forks source link

Error while importing -- Line number: 1 - no such column: part_supplierpart.active #7959

Open BorampetBhavani opened 2 months ago

BorampetBhavani commented 2 months ago

Please verify that this bug has NOT been raised before.

Describe the bug*

when ever I tried to import an excel sheet , I am getting the following error. Line number: 1 - no such column: part_supplierpart.active None, OFFICE TABLES, , None, None, None, None, None, None, None, 19, Assets-India, None, None, None, 0,1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, None, None, None, 0, None, None, None, None, 0, 1 Traceback (most recent call last): File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) sqlite3.OperationalError: no such column: part_supplierpart.active

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 823, in import_row diff.compare_with(self, instance, dry_run) File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 264, in compare_with self.right = self._export_resource_fields(resource, instance) File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 280, in _export_resource_fields return [ File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 281, in resource.export_field(f, instance) if instance else "" File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 1070, in export_field return field.export(obj) File "/opt/inventree/env/lib/python3.9/site-packages/import_export/fields.py", line 145, in export value = self.get_value(obj) File "/opt/inventree/env/lib/python3.9/site-packages/import_export/fields.py", line 107, in get_value value = getattr(value, attr, None) File "/opt/inventree/src/backend/InvenTree/part/models.py", line 2227, in on_order for sp in self.supplier_parts.all(): File "/opt/inventree/env/lib/python3.9/site-packages/django/db/models/query.py", line 398, in iter self._fetch_all() File "/opt/inventree/env/lib/python3.9/site-packages/django/db/models/query.py", line 1881, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/opt/inventree/env/lib/python3.9/site-packages/django/db/models/query.py", line 91, in iter results = compiler.execute_sql( File "/opt/inventree/env/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql cursor.execute(sql, params) File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/opt/inventree/env/lib/python3.9/site-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) django.db.utils.OperationalError: no such column: part_supplierpart.active

I am getting this error for every line . But when I leave "active" column empty , its giving me error like it can't be null. Please help me out to resolve this problem. Not only this when I tried to export or when i tried to delete a part , its showing internal server error and

Steps to Reproduce

go to admin layout , click on parts , there you will find import option, import csv file.

Expected behaviour

I used to import and export csv files in the inventree but now I am getting error for import , export and even while deleting a part.

Deployment Method

Version Information

15.3

Please verify if you can reproduce this bug on the demo site.

Relevant log output

Line number: 1 - no such column: part_supplierpart.active
None, OFFICE TABLES, , None, None, None, None, None, None, None, 19, Assets-India, None, None, None, 0,1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, None, None, None, 0, None, None, None, None, 0, 1
Traceback (most recent call last):
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
sqlite3.OperationalError: no such column: part_supplierpart.active

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 823, in import_row
diff.compare_with(self, instance, dry_run)
File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 264, in compare_with
self.right = self._export_resource_fields(resource, instance)
File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 280, in _export_resource_fields
return [
File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 281, in <listcomp>
resource.export_field(f, instance) if instance else ""
File "/opt/inventree/env/lib/python3.9/site-packages/import_export/resources.py", line 1070, in export_field
return field.export(obj)
File "/opt/inventree/env/lib/python3.9/site-packages/import_export/fields.py", line 145, in export
value = self.get_value(obj)
File "/opt/inventree/env/lib/python3.9/site-packages/import_export/fields.py", line 107, in get_value
value = getattr(value, attr, None)
File "/opt/inventree/src/backend/InvenTree/part/models.py", line 2227, in on_order
for sp in self.supplier_parts.all():
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/models/query.py", line 398, in __iter__
self._fetch_all()
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/inventree/env/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
django.db.utils.OperationalError: no such column: part_supplierpart.active
SchrodingersGat commented 2 months ago

It looks like your database was not synced on your last update. Can you run invoke migrate and provide the output here?

BorampetBhavani commented 2 months ago

Inventree is hosted on google cloud platform , I am a beginner so can you please tell me should I run invoke migrate in the google cloud shell?

SchrodingersGat commented 2 months ago

Inventree is hosted on google cloud platform , I am a beginner so can you please tell me should I run invoke migrate in the google cloud shell?

Probably. I have no idea how your setup is hosted, but wherever the source code is located, you simply run invoke migrate.

BorampetBhavani commented 2 months ago

Now I thought to do upgrade as it was not the latest version , I am getting this error , when I typed "sudo apt upgrade" \Errors were encountered while processing: /var/cache/apt/archives/inventree_0.16.0-rc0-1722955471.6937b3a2.focal_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

BorampetBhavani commented 2 months ago

And this output I got for command "invoke migrate"

Command 'invoke' not found, but can be installed with:

apt install python3-invoke Please ask your administrator.

SchrodingersGat commented 2 months ago

@BorampetBhavani sorry but your error messages here are not relevant to the issue you have posted. Did you install the InvenTree instance yourself? If not, please get the person who did to run the invoke migrate command.

BorampetBhavani commented 2 months ago

I am not using Docker, I am using a VM (Virtual machine)

matmair commented 2 months ago

Please provide concrete information and links on how you deployed inventree and post the full version information screen. We can not debug anything with the answers you are providing

BorampetBhavani commented 1 month ago

![Uploading Screenshot (169).png…]()