mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Added company details tab
This commit is contained in:
parent
d44a4e174b
commit
4ebd8cd6b1
@ -19,9 +19,6 @@
|
||||
<h4>{{ company.name }}</h4>
|
||||
<p>{{ company.description }}</p>
|
||||
</div>
|
||||
<div class='container-fluid'>
|
||||
<a href="{% url 'company-edit' company.id %}"><button class="btn btn-info">Edit Company Details</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
@ -1,15 +1,15 @@
|
||||
{% extends "delete_obj.html" %}
|
||||
|
||||
{% block del_title %}
|
||||
Are you sure you want to delete supplier '{{ supplier.name }}'?
|
||||
Are you sure you want to delete company '{{ company.name }}'?
|
||||
{% endblock %}
|
||||
|
||||
{% block del_body %}
|
||||
{% if supplier.part_count > 0 %}
|
||||
<p>There are {{ supplier.part_count }} parts sourced from this supplier.<br>
|
||||
{% if company.part_count > 0 %}
|
||||
<p>There are {{ company.part_count }} parts sourced from this company.<br>
|
||||
If this supplier is deleted, these supplier part entries will also be deleted.</p>
|
||||
<ul class='list-group'>
|
||||
{% for part in supplier.parts.all %}
|
||||
{% for part in company.parts.all %}
|
||||
<li class='list-group-item'><b>{{ part.SKU }}</b><br><i>Part - {{ part.part.name }}</i></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -4,4 +4,29 @@
|
||||
|
||||
{% include 'company/tabs.html' with tab='details' %}
|
||||
|
||||
<h3>Company Details</h3>
|
||||
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<td>Customer</td>
|
||||
<td>{% include 'yesnolabel.html' with value=company.is_customer %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Supplier</td>
|
||||
<td>{% include 'yesnolabel.html' with value=company.is_supplier %}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% if company.notes %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><b>Notes</b></div>
|
||||
<div class="panel-body">{{ company.notes }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class='container-fluid'>
|
||||
<a href="{% url 'company-edit' company.id %}"><button class="btn btn-info">Edit Company</button></a>
|
||||
<a href="{% url 'company-delete' company.id %}"><button class="btn btn-danger">Delete Company</button></a>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -1,5 +1,5 @@
|
||||
{% extends "create_edit_obj.html" %}
|
||||
|
||||
{% block obj_title %}
|
||||
Edit details for supplier '{{ supplier.name }}'
|
||||
Edit details for company '{{ company.name }}'
|
||||
{% endblock %}
|
69
wip/order_models.py
Normal file
69
wip/order_models.py
Normal file
@ -0,0 +1,69 @@
|
||||
class SupplierOrder(models.Model):
|
||||
"""
|
||||
An order of parts from a supplier, made up of multiple line items
|
||||
"""
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/supplier/order/{id}/".format(id=self.id)
|
||||
|
||||
# Interal reference for this order
|
||||
internal_ref = models.CharField(max_length=25, unique=True)
|
||||
|
||||
supplier = models.ForeignKey(Company, on_delete=models.CASCADE,
|
||||
related_name='orders')
|
||||
|
||||
created_date = models.DateField(auto_now_add=True, editable=False)
|
||||
|
||||
issued_date = models.DateField(blank=True, null=True, help_text="Date the purchase order was issued")
|
||||
|
||||
notes = models.TextField(blank=True, help_text="Order notes")
|
||||
|
||||
def __str__(self):
|
||||
return "PO {ref} ({status})".format(ref=self.internal_ref,
|
||||
status=self.get_status_display)
|
||||
|
||||
PENDING = 10 # Order is pending (not yet placed)
|
||||
PLACED = 20 # Order has been placed
|
||||
RECEIVED = 30 # Order has been received
|
||||
CANCELLED = 40 # Order was cancelled
|
||||
LOST = 50 # Order was lost
|
||||
|
||||
ORDER_STATUS_CODES = {PENDING: _("Pending"),
|
||||
PLACED: _("Placed"),
|
||||
CANCELLED: _("Cancelled"),
|
||||
RECEIVED: _("Received"),
|
||||
LOST: _("Lost")
|
||||
}
|
||||
|
||||
status = models.PositiveIntegerField(default=PENDING,
|
||||
choices=ORDER_STATUS_CODES.items())
|
||||
|
||||
delivery_date = models.DateField(blank=True, null=True)
|
||||
|
||||
|
||||
|
||||
class SupplierOrderLineItem(models.Model):
|
||||
"""
|
||||
A line item in a supplier order, corresponding to some quantity of part
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
unique_together = [
|
||||
('order', 'line_number'),
|
||||
('order', 'supplier_part'),
|
||||
('order', 'internal_part'),
|
||||
]
|
||||
|
||||
order = models.ForeignKey(SupplierOrder, on_delete=models.CASCADE)
|
||||
|
||||
line_number = models.PositiveIntegerField(default=1)
|
||||
|
||||
internal_part = models.ForeignKey(Part, null=True, blank=True, on_delete=models.SET_NULL)
|
||||
|
||||
supplier_part = models.ForeignKey(SupplierPart, null=True, blank=True, on_delete=models.SET_NULL)
|
||||
|
||||
quantity = models.PositiveIntegerField(default=1)
|
||||
|
||||
notes = models.TextField(blank=True)
|
||||
|
||||
received = models.BooleanField(default=False)
|
Loading…
Reference in New Issue
Block a user