2019-06-05 10:59:30 +00:00
|
|
|
"""
|
|
|
|
Django Forms for interacting with Order objects
|
|
|
|
"""
|
|
|
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2019-06-10 12:14:23 +00:00
|
|
|
from django import forms
|
2019-09-20 01:52:38 +00:00
|
|
|
from django.utils.translation import ugettext as _
|
2019-06-10 12:14:23 +00:00
|
|
|
|
2019-06-05 10:59:30 +00:00
|
|
|
from InvenTree.forms import HelperForm
|
|
|
|
|
2019-06-05 12:24:18 +00:00
|
|
|
from .models import PurchaseOrder, PurchaseOrderLineItem
|
|
|
|
|
|
|
|
|
|
|
|
class IssuePurchaseOrderForm(HelperForm):
|
|
|
|
|
2019-09-20 01:52:38 +00:00
|
|
|
confirm = forms.BooleanField(required=False, help_text=_('Place order'))
|
2019-06-10 12:14:23 +00:00
|
|
|
|
2019-06-05 12:24:18 +00:00
|
|
|
class Meta:
|
|
|
|
model = PurchaseOrder
|
|
|
|
fields = [
|
2019-06-10 12:14:23 +00:00
|
|
|
'confirm',
|
2019-06-05 12:24:18 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
2019-09-20 01:52:38 +00:00
|
|
|
class CancelPurchaseOrderForm(HelperForm):
|
|
|
|
|
|
|
|
confirm = forms.BooleanField(required=False, help_text=_('Cancel order'))
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = PurchaseOrder
|
|
|
|
fields = [
|
|
|
|
'confirm',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2019-06-05 12:24:18 +00:00
|
|
|
class EditPurchaseOrderForm(HelperForm):
|
|
|
|
""" Form for editing a PurchaseOrder object """
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = PurchaseOrder
|
|
|
|
fields = [
|
|
|
|
'reference',
|
|
|
|
'supplier',
|
|
|
|
'description',
|
|
|
|
'URL',
|
|
|
|
'notes'
|
|
|
|
]
|
2019-06-05 10:59:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EditPurchaseOrderLineItemForm(HelperForm):
|
2019-06-05 12:24:18 +00:00
|
|
|
""" Form for editing a PurchaseOrderLineItem object """
|
2019-06-05 10:59:30 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = PurchaseOrderLineItem
|
|
|
|
fields = [
|
|
|
|
'order',
|
|
|
|
'part',
|
|
|
|
'quantity',
|
|
|
|
'reference',
|
2019-06-13 11:57:35 +00:00
|
|
|
'notes',
|
2019-06-05 11:56:52 +00:00
|
|
|
]
|