mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 04:25:42 +00:00
Create a new purchase order from a company page
This commit is contained in:
@ -10,7 +10,7 @@ from django.views.generic import DetailView, ListView
|
||||
from django.forms import HiddenInput
|
||||
|
||||
from .models import PurchaseOrder, PurchaseOrderLineItem
|
||||
from company.models import SupplierPart
|
||||
from company.models import Company, SupplierPart
|
||||
|
||||
from . import forms as order_forms
|
||||
|
||||
@ -70,6 +70,15 @@ class PurchaseOrderCreate(AjaxCreateView):
|
||||
|
||||
initials['status'] = OrderStatus.PENDING
|
||||
|
||||
supplier_id = self.request.GET.get('supplier', None)
|
||||
|
||||
if supplier_id:
|
||||
try:
|
||||
supplier = Company.objects.get(id=supplier_id)
|
||||
initials['supplier'] = supplier
|
||||
except Company.DoesNotExist:
|
||||
pass
|
||||
|
||||
return initials
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user