Bug fix for recent SupplierPart API annotation (#3336)

This commit is contained in:
Oliver 2022-07-15 20:30:26 +10:00 committed by GitHub
parent 653dcd4526
commit 6e2a2f2b2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View File

@ -284,7 +284,7 @@ class SupplierPartSerializer(InvenTreeModelSerializer):
"""
queryset = queryset.annotate(
in_stock=part.filters.annotate_total_stock(reference='part__')
in_stock=part.filters.annotate_total_stock()
)
return queryset

View File

@ -0,0 +1,20 @@
# Generated by Django 3.2.14 on 2022-07-15 07:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('company', '0046_alter_company_image'),
('stock', '0077_alter_stockitem_notes'),
]
operations = [
migrations.AlterField(
model_name='stockitem',
name='supplier_part',
field=models.ForeignKey(blank=True, help_text='Select a matching supplier part for this stock item', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stock_items', to='company.supplierpart', verbose_name='Supplier Part'),
),
]

View File

@ -598,7 +598,8 @@ class StockItem(MetadataMixin, MPTTModel):
supplier_part = models.ForeignKey(
'company.SupplierPart', blank=True, null=True, on_delete=models.SET_NULL,
verbose_name=_('Supplier Part'),
help_text=_('Select a matching supplier part for this stock item')
help_text=_('Select a matching supplier part for this stock item'),
related_name='stock_items',
)
# Note: When a StockLocation is deleted, stock items are updated via a signal