mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add 'manufacturer' field to SupplierPart object
- ForeignKey link to Company model
This commit is contained in:
parent
e9e734acce
commit
acebe61ac5
@ -115,7 +115,8 @@ class SupplierPartList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
filter_fields = [
|
filter_fields = [
|
||||||
'part',
|
'part',
|
||||||
'supplier'
|
'supplier',
|
||||||
|
'manufacturer',
|
||||||
]
|
]
|
||||||
|
|
||||||
search_fields = [
|
search_fields = [
|
||||||
|
@ -13,6 +13,6 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='company',
|
model_name='company',
|
||||||
name='is_manufacturer',
|
name='is_manufacturer',
|
||||||
field=models.BooleanField(default=True, help_text='Does this company manufacture parts?'),
|
field=models.BooleanField(default=False, help_text='Does this company manufacture parts?'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -265,7 +265,7 @@ class SupplierPart(models.Model):
|
|||||||
related_name='manufactured_parts',
|
related_name='manufactured_parts',
|
||||||
limit_choices_to={'is_manufacturer': True},
|
limit_choices_to={'is_manufacturer': True},
|
||||||
help_text=_('Select manufacturer'),
|
help_text=_('Select manufacturer'),
|
||||||
null=True, blank=True,
|
null=True, blank=True
|
||||||
)
|
)
|
||||||
|
|
||||||
manufacturer_name = models.CharField(max_length=100, blank=True, help_text=_('Manufacturer'))
|
manufacturer_name = models.CharField(max_length=100, blank=True, help_text=_('Manufacturer'))
|
||||||
@ -296,7 +296,7 @@ class SupplierPart(models.Model):
|
|||||||
items = []
|
items = []
|
||||||
|
|
||||||
if self.manufacturer:
|
if self.manufacturer:
|
||||||
items.append(self.manufacturer)
|
items.append(self.manufacturer.name)
|
||||||
if self.MPN:
|
if self.MPN:
|
||||||
items.append(self.MPN)
|
items.append(self.MPN)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user