mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 05:25:42 +00:00
Add part detail page for company / supplier
This commit is contained in:
@ -403,6 +403,18 @@ class SupplierPart(models.Model):
|
||||
# lead time for parts that cannot be delivered immediately
|
||||
lead_time = models.DurationField(blank=True, null=True)
|
||||
|
||||
@property
|
||||
def manufacturer_string(self):
|
||||
|
||||
items = []
|
||||
|
||||
if self.manufacturer:
|
||||
items.append(self.manufacturer)
|
||||
if self.MPN:
|
||||
items.append(self.MPN)
|
||||
|
||||
return ' | '.join(items)
|
||||
|
||||
def __str__(self):
|
||||
return "{sku} - {supplier}".format(
|
||||
sku=self.SKU,
|
||||
|
@ -17,10 +17,7 @@
|
||||
<tr>
|
||||
<td><a href="{% url 'supplier-part-detail' spart.id %}">{{ spart.SKU }}</a></td>
|
||||
<td><a href="{% url 'company-detail' spart.supplier.id %}">{{ spart.supplier.name }}</a></td>
|
||||
<td>
|
||||
{% if spart.manufacturer %}{{ spart.manufacturer.name }}{% endif %}
|
||||
{% if spart.MPN %} | {{ spart.MPN }}{% endif %}
|
||||
</td>
|
||||
<td>{{ spart.manufacturer_string }}</td>
|
||||
<td>
|
||||
{% if spart.URL %}
|
||||
<a href="{{ spart.URL }}">{{ spart.URL }}</a>
|
||||
|
@ -7,6 +7,7 @@ from django.http import HttpResponseRedirect
|
||||
from django.views.generic import DetailView, ListView
|
||||
from django.views.generic.edit import UpdateView, DeleteView, CreateView
|
||||
|
||||
from company.models import Company
|
||||
from .models import PartCategory, Part, BomItem
|
||||
from .models import SupplierPart
|
||||
|
||||
@ -226,7 +227,7 @@ class SupplierPartCreate(CreateView):
|
||||
part_id = self.request.GET.get('part', None)
|
||||
|
||||
if supplier_id:
|
||||
initials['supplier'] = get_object_or_404(Supplier, pk=supplier_id)
|
||||
initials['supplier'] = get_object_or_404(Company, pk=supplier_id)
|
||||
# TODO
|
||||
# self.fields['supplier'].disabled = True
|
||||
if part_id:
|
||||
|
Reference in New Issue
Block a user