mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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 %}
|
||||
|
||||
{% if customer_orders.all|length > 0 %}
|
||||
<h4>Customer Orders</h4>
|
||||
{% include "customer_orders/customer_orders_list.html" with customer_orders=customer_orders %}
|
||||
{% endif %}
|
||||
<h3>Customers</h3>
|
||||
|
||||
<ul class='list-group'>
|
||||
{% 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 %}
|
@ -10,13 +10,15 @@ from .models import Customer, CustomerOrder
|
||||
class CustomerIndex(ListView):
|
||||
model = Customer
|
||||
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):
|
||||
model = CustomerOrder
|
||||
template_name = 'customer/order_index.html'
|
||||
context_object_name = 'customer_orders'
|
||||
context_object_name = 'orders'
|
||||
|
||||
|
||||
class CustomerDetail(DetailView):
|
||||
|
@ -31,6 +31,7 @@ class EditPartForm(forms.ModelForm):
|
||||
'trackable',
|
||||
'purchaseable',
|
||||
'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?
|
||||
salable = models.BooleanField(default=False, help_text="Can this part be sold to customers?")
|
||||
|
||||
notes = models.TextField(blank=True)
|
||||
|
||||
def __str__(self):
|
||||
if self.IPN:
|
||||
return "{name} ({ipn})".format(
|
||||
|
@ -63,6 +63,13 @@
|
||||
{% endif %}
|
||||
</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'>
|
||||
<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>
|
||||
|
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)
|
||||
|
||||
# Optional longer description
|
||||
description = models.CharField(max_length=1024, blank=True)
|
||||
notes = models.TextField(blank=True)
|
||||
|
||||
# Which user created this tracking entry?
|
||||
user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
|
||||
|
@ -25,6 +25,14 @@ class Supplier(Company):
|
||||
def has_parts(self):
|
||||
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):
|
||||
""" Represents a manfufacturer
|
||||
|
@ -41,10 +41,9 @@
|
||||
<div class="panel-heading"><b>Notes</b></div>
|
||||
<div class="panel-body">{{ order.notes }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h2>TODO</h2>
|
||||
Here we list all the line ites which exist under this order...
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
@ -23,4 +23,9 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<div class='container-fluid'>
|
||||
<a href="{% url 'supplier-order-create' %}?supplier={{ supplier.id }}">
|
||||
<button class="btn btn-success">New Order</button>
|
||||
</a>
|
||||
|
||||
{% endblock %}
|
@ -1,6 +1,6 @@
|
||||
<ul class='nav nav-tabs'>
|
||||
<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 %}>
|
||||
<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>
|
@ -25,6 +25,16 @@ class SupplierOrderCreate(CreateView):
|
||||
context_object_name = 'supplier'
|
||||
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):
|
||||
model = Supplier
|
||||
|
Loading…
Reference in New Issue
Block a user