mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Fixed spash page for customer index
Added 'notes' field to Part object
This commit is contained in:
parent
f66a751608
commit
a4621295a6
@ -3,9 +3,16 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% if customer_orders.all|length > 0 %}
|
<h3>Customers</h3>
|
||||||
<h4>Customer Orders</h4>
|
|
||||||
{% include "customer_orders/customer_orders_list.html" with customer_orders=customer_orders %}
|
<ul class='list-group'>
|
||||||
{% endif %}
|
{% for customer in customers %}
|
||||||
|
<li class='list-group-item'>
|
||||||
|
<b><a href="{% url 'customer-detail' customer.id %}">{{ customer.name }}</a></b>
|
||||||
|
<br>
|
||||||
|
{{ customer.description }}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -10,13 +10,15 @@ from .models import Customer, CustomerOrder
|
|||||||
class CustomerIndex(ListView):
|
class CustomerIndex(ListView):
|
||||||
model = Customer
|
model = Customer
|
||||||
template_name = 'customer/index.html'
|
template_name = 'customer/index.html'
|
||||||
context_obect_name = 'customers'
|
context_object_name = 'customers'
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return Customer.objects.order_by('name')
|
||||||
|
|
||||||
class CustomerOrderIndex(ListView):
|
class CustomerOrderIndex(ListView):
|
||||||
model = CustomerOrder
|
model = CustomerOrder
|
||||||
template_name = 'customer/order_index.html'
|
template_name = 'customer/order_index.html'
|
||||||
context_object_name = 'customer_orders'
|
context_object_name = 'orders'
|
||||||
|
|
||||||
|
|
||||||
class CustomerDetail(DetailView):
|
class CustomerDetail(DetailView):
|
||||||
|
@ -31,6 +31,7 @@ class EditPartForm(forms.ModelForm):
|
|||||||
'trackable',
|
'trackable',
|
||||||
'purchaseable',
|
'purchaseable',
|
||||||
'salable',
|
'salable',
|
||||||
|
'notes',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
20
InvenTree/part/migrations/0023_part_notes.py
Normal file
20
InvenTree/part/migrations/0023_part_notes.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.12 on 2018-04-17 15:34
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('part', '0022_auto_20180417_0819'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='part',
|
||||||
|
name='notes',
|
||||||
|
field=models.TextField(blank=True),
|
||||||
|
),
|
||||||
|
]
|
@ -139,6 +139,8 @@ class Part(models.Model):
|
|||||||
# Can this part be sold to customers?
|
# Can this part be sold to customers?
|
||||||
salable = models.BooleanField(default=False, help_text="Can this part be sold to customers?")
|
salable = models.BooleanField(default=False, help_text="Can this part be sold to customers?")
|
||||||
|
|
||||||
|
notes = models.TextField(blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.IPN:
|
if self.IPN:
|
||||||
return "{name} ({ipn})".format(
|
return "{name} ({ipn})".format(
|
||||||
|
@ -63,6 +63,13 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
{% if part.notes %}
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading"><b>Notes</b></div>
|
||||||
|
<div class="panel-body">{{ part.notes }}</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class='container-fluid'>
|
<div class='container-fluid'>
|
||||||
<a href="{% url 'part-edit' part.id %}"><button class="btn btn-info">Edit Part</button></a>
|
<a href="{% url 'part-edit' part.id %}"><button class="btn btn-info">Edit Part</button></a>
|
||||||
<a href="{% url 'part-delete' part.id %}"><button class="btn btn-danger">Delete Part</button></a>
|
<a href="{% url 'part-delete' part.id %}"><button class="btn btn-danger">Delete Part</button></a>
|
||||||
|
24
InvenTree/stock/migrations/0017_auto_20180417_1536.py
Normal file
24
InvenTree/stock/migrations/0017_auto_20180417_1536.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.12 on 2018-04-17 15:36
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('stock', '0016_auto_20180417_1516'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='stockitemtracking',
|
||||||
|
name='description',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='stockitemtracking',
|
||||||
|
name='notes',
|
||||||
|
field=models.TextField(blank=True),
|
||||||
|
),
|
||||||
|
]
|
@ -210,7 +210,7 @@ class StockItemTracking(models.Model):
|
|||||||
title = models.CharField(max_length=250)
|
title = models.CharField(max_length=250)
|
||||||
|
|
||||||
# Optional longer description
|
# Optional longer description
|
||||||
description = models.CharField(max_length=1024, blank=True)
|
notes = models.TextField(blank=True)
|
||||||
|
|
||||||
# Which user created this tracking entry?
|
# Which user created this tracking entry?
|
||||||
user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
|
user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
|
||||||
|
@ -25,6 +25,14 @@ class Supplier(Company):
|
|||||||
def has_parts(self):
|
def has_parts(self):
|
||||||
return self.part_count > 0
|
return self.part_count > 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def order_count(self):
|
||||||
|
return self.orders.count()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def has_orders(self):
|
||||||
|
return self.order_count > 0
|
||||||
|
|
||||||
|
|
||||||
class Manufacturer(Company):
|
class Manufacturer(Company):
|
||||||
""" Represents a manfufacturer
|
""" Represents a manfufacturer
|
||||||
@ -176,4 +184,4 @@ class SupplierOrderLineItem(models.Model):
|
|||||||
|
|
||||||
notes = models.TextField(blank=True)
|
notes = models.TextField(blank=True)
|
||||||
|
|
||||||
received = models.BooleanField(default=False)
|
received = models.BooleanField(default=False)
|
||||||
|
@ -41,10 +41,9 @@
|
|||||||
<div class="panel-heading"><b>Notes</b></div>
|
<div class="panel-heading"><b>Notes</b></div>
|
||||||
<div class="panel-body">{{ order.notes }}</div>
|
<div class="panel-body">{{ order.notes }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h2>TODO</h2>
|
<h2>TODO</h2>
|
||||||
Here we list all the line ites which exist under this order...
|
Here we list all the line ites which exist under this order...
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -23,4 +23,9 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div class='container-fluid'>
|
||||||
|
<a href="{% url 'supplier-order-create' %}?supplier={{ supplier.id }}">
|
||||||
|
<button class="btn btn-success">New Order</button>
|
||||||
|
</a>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,6 +1,6 @@
|
|||||||
<ul class='nav nav-tabs'>
|
<ul class='nav nav-tabs'>
|
||||||
<li{% if tab == 'parts' %} class='active'{% endif %}>
|
<li{% if tab == 'parts' %} class='active'{% endif %}>
|
||||||
<a href="{% url 'supplier-detail' supplier.id %}">Parts</a></li>
|
<a href="{% url 'supplier-detail' supplier.id %}">Parts <span class='badge'>{{ supplier.part_count }}</span></a></li>
|
||||||
<li{% if tab == 'order' %} class='active'{% endif %}>
|
<li{% if tab == 'order' %} class='active'{% endif %}>
|
||||||
<a href="{% url 'supplier-detail-orders' supplier.id %}">Orders</a></li>
|
<a href="{% url 'supplier-detail-orders' supplier.id %}">Orders <span class="badge">{{ supplier.order_count }}</span></a></li>
|
||||||
</ul>
|
</ul>
|
@ -25,6 +25,16 @@ class SupplierOrderCreate(CreateView):
|
|||||||
context_object_name = 'supplier'
|
context_object_name = 'supplier'
|
||||||
template_name = 'supplier/order_create.html'
|
template_name = 'supplier/order_create.html'
|
||||||
|
|
||||||
|
def get_initial(self):
|
||||||
|
initials = super(SupplierOrderCreate, self).get_initial().copy()
|
||||||
|
|
||||||
|
s_id = self.request.GET.get('supplier', None)
|
||||||
|
|
||||||
|
if s_id:
|
||||||
|
initials['supplier'] = get_object_or_404(Supplier, pk=s_id)
|
||||||
|
|
||||||
|
return initials
|
||||||
|
|
||||||
|
|
||||||
class SupplierIndex(ListView):
|
class SupplierIndex(ListView):
|
||||||
model = Supplier
|
model = Supplier
|
||||||
|
Loading…
x
Reference in New Issue
Block a user