mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Added company details tab
This commit is contained in:
		| @@ -19,9 +19,6 @@ | |||||||
|               <h4>{{ company.name }}</h4> |               <h4>{{ company.name }}</h4> | ||||||
|               <p>{{ company.description }}</p> |               <p>{{ company.description }}</p> | ||||||
|           </div> |           </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> |     </div> | ||||||
|     <div class="col-sm-6"> |     <div class="col-sm-6"> | ||||||
|   | |||||||
| @@ -1,15 +1,15 @@ | |||||||
| {% extends "delete_obj.html" %} | {% extends "delete_obj.html" %} | ||||||
|  |  | ||||||
| {% block del_title %} | {% block del_title %} | ||||||
| Are you sure you want to delete supplier '{{ supplier.name }}'? | Are you sure you want to delete company '{{ company.name }}'? | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block del_body %} | {% block del_body %} | ||||||
| {% if supplier.part_count > 0 %} | {% if company.part_count > 0 %} | ||||||
| <p>There are {{ supplier.part_count }} parts sourced from this supplier.<br> | <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> | If this supplier is deleted, these supplier part entries will also be deleted.</p> | ||||||
| <ul class='list-group'> | <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> | <li class='list-group-item'><b>{{ part.SKU }}</b><br><i>Part - {{ part.part.name }}</i></li> | ||||||
| {% endfor %} | {% endfor %} | ||||||
| </ul> | </ul> | ||||||
|   | |||||||
| @@ -4,4 +4,29 @@ | |||||||
|  |  | ||||||
| {% include 'company/tabs.html' with tab='details' %} | {% 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 %} | {% endblock %} | ||||||
| @@ -1,5 +1,5 @@ | |||||||
| {% extends "create_edit_obj.html" %} | {% extends "create_edit_obj.html" %} | ||||||
|  |  | ||||||
| {% block obj_title %} | {% block obj_title %} | ||||||
| Edit details for supplier '{{ supplier.name }}' | Edit details for company '{{ company.name }}' | ||||||
| {% endblock %} | {% 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) | ||||||
		Reference in New Issue
	
	Block a user