mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fixes required for v3.2 compatibility
- Specify DEFAULT_AUTO_FIELD - Specify output_field for annotations
This commit is contained in:
parent
12f1fb9526
commit
6b9145ae56
@ -52,6 +52,9 @@ def get_setting(environment_var, backup_val, default_value=None):
|
||||
# Determine if we are running in "test" mode e.g. "manage.py test"
|
||||
TESTING = 'test' in sys.argv
|
||||
|
||||
# New requirement for django 3.2+
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
@ -807,7 +807,13 @@ class Build(MPTTModel):
|
||||
|
||||
allocations = self.allocatedItems(part, output)
|
||||
|
||||
allocated = allocations.aggregate(q=Coalesce(Sum('quantity'), 0))
|
||||
allocated = allocations.aggregate(
|
||||
q=Coalesce(
|
||||
Sum('quantity'),
|
||||
0,
|
||||
output_field=models.DecimalField(),
|
||||
)
|
||||
)
|
||||
|
||||
return allocated['q']
|
||||
|
||||
|
@ -1189,10 +1189,13 @@ class Part(MPTTModel):
|
||||
against both build orders and sales orders.
|
||||
"""
|
||||
|
||||
return sum([
|
||||
return sum(
|
||||
[
|
||||
self.build_order_allocation_count(),
|
||||
self.sales_order_allocation_count(),
|
||||
])
|
||||
],
|
||||
output_field=models.DecimalField()
|
||||
)
|
||||
|
||||
def stock_entries(self, include_variants=True, in_stock=None):
|
||||
""" Return all stock entries for this Part.
|
||||
|
@ -2,7 +2,7 @@ invoke>=1.4.0 # Invoke build tool
|
||||
wheel>=0.34.2 # Wheel
|
||||
Django==3.2 # Django package
|
||||
pillow==8.1.1 # Image manipulation
|
||||
djangorestframework==3.11.2 # DRF framework
|
||||
djangorestframework==3.12.4 # DRF framework
|
||||
django-dbbackup==3.3.0 # Database backup / restore functionality
|
||||
django-cors-headers==3.2.0 # CORS headers extension for DRF
|
||||
django-filter==2.4.0 # Extended filtering options
|
||||
@ -13,7 +13,7 @@ django-markdownify==0.8.0 # Markdown rendering
|
||||
coreapi==2.3.0 # API documentation
|
||||
pygments==2.7.4 # Syntax highlighting
|
||||
tablib==0.13.0 # Import / export data files
|
||||
django-crispy-forms==1.8.1 # Form helpers
|
||||
django-crispy-forms==1.11.2 # Form helpers
|
||||
django-import-export==2.0.0 # Data import / export for admin interface
|
||||
django-cleanup==5.1.0 # Manage deletion of old / unused uploaded files
|
||||
flake8==3.8.3 # PEP checking
|
||||
|
Loading…
Reference in New Issue
Block a user