mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add tab view for supplier page
- "Parts" tab - "Orders" tab
This commit is contained in:
parent
5769befb04
commit
7045443d7b
@ -15,18 +15,25 @@ class Company(models.Model):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
name = models.CharField(max_length=100, unique=True)
|
||||
name = models.CharField(max_length=100, unique=True,
|
||||
help_text='Company naem')
|
||||
|
||||
description = models.CharField(max_length=500)
|
||||
website = models.URLField(blank=True)
|
||||
|
||||
website = models.URLField(blank=True, help_text='Company website URL')
|
||||
|
||||
address = models.CharField(max_length=200,
|
||||
blank=True)
|
||||
blank=True, help_text='Company address')
|
||||
|
||||
phone = models.CharField(max_length=50,
|
||||
blank=True)
|
||||
|
||||
email = models.EmailField(blank=True)
|
||||
|
||||
contact = models.CharField(max_length=100,
|
||||
blank=True)
|
||||
notes = models.CharField(max_length=500,
|
||||
blank=True)
|
||||
|
||||
notes = models.TextField(blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
35
InvenTree/customer/migrations/0002_auto_20180417_1436.py
Normal file
35
InvenTree/customer/migrations/0002_auto_20180417_1436.py
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.12 on 2018-04-17 14:36
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('customer', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customer',
|
||||
name='address',
|
||||
field=models.CharField(blank=True, help_text='Company address', max_length=200),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customer',
|
||||
name='name',
|
||||
field=models.CharField(help_text='Company naem', max_length=100, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customer',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customer',
|
||||
name='website',
|
||||
field=models.URLField(blank=True, help_text='Company website URL'),
|
||||
),
|
||||
]
|
@ -1,23 +1,31 @@
|
||||
<ul class="nav nav-tabs">
|
||||
<li{% ifequal tab 'detail' %} class="active"{% endifequal %}><a href="{% url 'part-detail' part.id %}">Details</a></li>
|
||||
<li{% ifequal tab 'detail' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-detail' part.id %}">Details</a></li>
|
||||
{% if part.buildable %}
|
||||
<li{% ifequal tab 'bom' %} class="active"{% endifequal %}><a href="{% url 'part-bom' part.id %}">BOM<span class="badge">{{ part.bom_count }}</span></a></li>
|
||||
<li{% ifequal tab 'build' %} class="active"{% endifequal %}><a href="{% url 'part-build' part.id %}">Build<span class='badge'>{{ part.can_build }}</span></a></li>
|
||||
<li{% ifequal tab 'bom' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-bom' part.id %}">BOM<span class="badge">{{ part.bom_count }}</span></a></li>
|
||||
<li{% ifequal tab 'build' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-build' part.id %}">Build<span class='badge'>{{ part.can_build }}</span></a></li>
|
||||
{% endif %}
|
||||
{% if part.used_in_count > 0 %}
|
||||
<li{% ifequal tab 'used' %} class="active"{% endifequal %}><a href="{% url 'part-used-in' part.id %}">Used In{% if part.used_in_count > 0 %}<span class="badge">{{ part.used_in_count }}</span>{% endif %}</a></li>
|
||||
<li{% ifequal tab 'used' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-used-in' part.id %}">Used In{% if part.used_in_count > 0 %}<span class="badge">{{ part.used_in_count }}</span>{% endif %}</a></li>
|
||||
{% endif %}
|
||||
<li{% ifequal tab 'stock' %} class="active"{% endifequal %}><a href="{% url 'part-stock' part.id %}">Stock <span class="badge">{{ part.total_stock }}</span></a></li>
|
||||
<li{% ifequal tab 'stock' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-stock' part.id %}">Stock <span class="badge">{{ part.total_stock }}</span></a></li>
|
||||
{% if part.allocation_count > 0 %}
|
||||
<li{% ifequal tab 'allocation' %} class="active"{% endifequal %}><a href="{% url 'part-allocation' part.id %}">Allocated <span class="badge">{{ part.allocation_count }}</span></a></li>
|
||||
<li{% ifequal tab 'allocation' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-allocation' part.id %}">Allocated <span class="badge">{{ part.allocation_count }}</span></a></li>
|
||||
{% endif %}
|
||||
{% if part.purchaseable %}
|
||||
<li{% ifequal tab 'suppliers' %} class="active"{% endifequal %}><a href="{% url 'part-suppliers' part.id %}">Suppliers
|
||||
<li{% ifequal tab 'suppliers' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-suppliers' part.id %}">Suppliers
|
||||
<span class="badge">{{ part.supplier_count }}<span>
|
||||
</a></li>
|
||||
{% endif %}
|
||||
{% if part.trackable %}
|
||||
<li{% ifequal tab 'track' %} class="active"{% endifequal %}><a href="{% url 'part-track' part.id %}">Tracking
|
||||
<li{% ifequal tab 'track' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-track' part.id %}">Tracking
|
||||
{% if parts.serials.all|length > 0 %}
|
||||
<span class="badge">{{ part.serials.all|length }}</span>
|
||||
{% endif %}
|
||||
|
@ -2,7 +2,7 @@ from django.contrib import admin
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
|
||||
from .models import Supplier, SupplierPart, Manufacturer
|
||||
|
||||
from .models import SupplierOrder
|
||||
|
||||
class SupplierAdmin(ImportExportModelAdmin):
|
||||
list_display = ('name', 'website', 'contact')
|
||||
@ -16,6 +16,11 @@ class SupplierPartAdmin(ImportExportModelAdmin):
|
||||
list_display = ('part', 'supplier', 'SKU')
|
||||
|
||||
|
||||
class SupplierOrderAdmin(admin.ModelAdmin):
|
||||
list_display = ('internal_ref', 'supplier', 'issued_date')
|
||||
|
||||
|
||||
admin.site.register(Supplier, SupplierAdmin)
|
||||
admin.site.register(Manufacturer, ManufacturerAdmin)
|
||||
admin.site.register(SupplierPart, SupplierPartAdmin)
|
||||
admin.site.register(SupplierOrder, SupplierOrderAdmin)
|
||||
|
61
InvenTree/supplier/migrations/0011_auto_20180417_1436.py
Normal file
61
InvenTree/supplier/migrations/0011_auto_20180417_1436.py
Normal file
@ -0,0 +1,61 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.12 on 2018-04-17 14:36
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('supplier', '0010_auto_20180417_1420'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='manufacturer',
|
||||
name='address',
|
||||
field=models.CharField(blank=True, help_text='Company address', max_length=200),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='manufacturer',
|
||||
name='name',
|
||||
field=models.CharField(help_text='Company naem', max_length=100, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='manufacturer',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='manufacturer',
|
||||
name='website',
|
||||
field=models.URLField(blank=True, help_text='Company website URL'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplier',
|
||||
name='address',
|
||||
field=models.CharField(blank=True, help_text='Company address', max_length=200),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplier',
|
||||
name='name',
|
||||
field=models.CharField(help_text='Company naem', max_length=100, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplier',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplier',
|
||||
name='website',
|
||||
field=models.URLField(blank=True, help_text='Company website URL'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplierorder',
|
||||
name='supplier',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='orders', to='supplier.Supplier'),
|
||||
),
|
||||
]
|
@ -116,7 +116,8 @@ class SupplierOrder(models.Model):
|
||||
# Interal reference for this order
|
||||
internal_ref = models.CharField(max_length=25, unique=True)
|
||||
|
||||
supplier = models.ForeignKey(Supplier, on_delete=models.CASCADE)
|
||||
supplier = models.ForeignKey(Supplier, on_delete=models.CASCADE,
|
||||
related_name='orders')
|
||||
|
||||
created_date = models.DateField(auto_now_add=True, editable=False)
|
||||
|
||||
|
@ -1,45 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "supplier/supplier_base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% block details %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h3>{{ supplier.name }}</h3>
|
||||
<p>{{ supplier.description }}</p>
|
||||
<p>{{ supplier.notes }}</p>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<table class="table">
|
||||
{% if supplier.website %}
|
||||
<tr>
|
||||
<td>Website</td><td><a href="{{ supplier.website }}">{{ supplier.website }}</a></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if supplier.address %}
|
||||
<tr>
|
||||
<td>Address</td><td>{{ supplier.address }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if supplier.phone %}
|
||||
<tr>
|
||||
<td>Phone</td><td>{{ supplier.phone }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if supplier.email %}
|
||||
<tr>
|
||||
<td>Email</td><td>{{ supplier.email }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if supplier.contact %}
|
||||
<tr>
|
||||
<td>Contact</td><td>{{ supplier.contact }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% include "supplier/tabs.html" with tab='parts' %}
|
||||
|
||||
<h4>Supplier Parts</h3>
|
||||
<h3>Supplier Parts</h3>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>SKU</th>
|
||||
@ -77,4 +42,5 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
24
InvenTree/supplier/templates/supplier/orders.html
Normal file
24
InvenTree/supplier/templates/supplier/orders.html
Normal file
@ -0,0 +1,24 @@
|
||||
{% extends "supplier/supplier_base.html" %}
|
||||
|
||||
{% block details %}
|
||||
|
||||
{% include "supplier/tabs.html" with tab='order' %}
|
||||
|
||||
<h3>Supplier Orders</h3>
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Reference</th>
|
||||
<th>Issued</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
{% for order in supplier.orders.all %}
|
||||
<tr>
|
||||
<td><a href="{% url 'supplier-order-detail' order.id %}">{{ order.internal_ref }}</a></td>
|
||||
<td>{% if order.issued_date %}{{ order.issued_date }}{% endif %}</td>
|
||||
<td>Status</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
46
InvenTree/supplier/templates/supplier/supplier_base.html
Normal file
46
InvenTree/supplier/templates/supplier/supplier_base.html
Normal file
@ -0,0 +1,46 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h3>{{ supplier.name }}</h3>
|
||||
<p>{{ supplier.description }}</p>
|
||||
<p>{{ supplier.notes }}</p>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<table class="table">
|
||||
{% if supplier.website %}
|
||||
<tr>
|
||||
<td>Website</td><td><a href="{{ supplier.website }}">{{ supplier.website }}</a></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if supplier.address %}
|
||||
<tr>
|
||||
<td>Address</td><td>{{ supplier.address }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if supplier.phone %}
|
||||
<tr>
|
||||
<td>Phone</td><td>{{ supplier.phone }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if supplier.email %}
|
||||
<tr>
|
||||
<td>Email</td><td>{{ supplier.email }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if supplier.contact %}
|
||||
<tr>
|
||||
<td>Contact</td><td>{{ supplier.contact }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block details %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
6
InvenTree/supplier/templates/supplier/tabs.html
Normal file
6
InvenTree/supplier/templates/supplier/tabs.html
Normal file
@ -0,0 +1,6 @@
|
||||
<ul class='nav nav-tabs'>
|
||||
<li{% if tab == 'parts' %} class='active'{% endif %}>
|
||||
<a href="{% url 'supplier-detail' supplier.id %}">Parts</a></li>
|
||||
<li{% if tab == 'order' %} class='active'{% endif %}>
|
||||
<a href="{% url 'supplier-detail-orders' supplier.id %}">Orders</a></li>
|
||||
</ul>
|
@ -51,6 +51,8 @@ supplier_detail_urls = [
|
||||
url(r'edit/?', views.SupplierEdit.as_view(), name='supplier-edit'),
|
||||
url(r'delete/?', views.SupplierDelete.as_view(), name='supplier-delete'),
|
||||
|
||||
url(r'orders/?', views.SupplierDetail.as_view(template_name='supplier/orders.html'), name='supplier-detail-orders'),
|
||||
|
||||
url(r'^.*$', views.SupplierDetail.as_view(), name='supplier-detail'),
|
||||
]
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
<li><a href="{% url 'stock-index' %}">Stock</a></li>
|
||||
<li><a href="{% url 'build-index' %}">Build</a></li>
|
||||
<li><a href="{% url 'supplier-index' %}">Suppliers</a></li>
|
||||
<li><a href="{% url 'customer-order-index' %}">Customer Orders</a></li>
|
||||
<li><a href="{% url 'customer-index' %}">Customers</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
Loading…
Reference in New Issue
Block a user