59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
"""Формы документов."""
|
|
from django import forms
|
|
from .models import (
|
|
CustomerOrder,
|
|
CustomerOrderItem,
|
|
SupplierOrder,
|
|
SupplierOrderItem,
|
|
CashInflow,
|
|
CashTransfer,
|
|
CashExpense,
|
|
)
|
|
from django.forms import inlineformset_factory
|
|
|
|
CustomerOrderItemFormSet = inlineformset_factory(
|
|
CustomerOrder,
|
|
CustomerOrderItem,
|
|
fields=("product", "price", "currency", "quantity"),
|
|
extra=1,
|
|
can_delete=True,
|
|
)
|
|
|
|
SupplierOrderItemFormSet = inlineformset_factory(
|
|
SupplierOrder,
|
|
SupplierOrderItem,
|
|
fields=("product", "price", "currency", "quantity"),
|
|
extra=1,
|
|
can_delete=True,
|
|
)
|
|
|
|
|
|
class CustomerOrderForm(forms.ModelForm):
|
|
class Meta:
|
|
model = CustomerOrder
|
|
fields = ("date", "number", "order_kind", "organization", "client", "author")
|
|
|
|
|
|
class SupplierOrderForm(forms.ModelForm):
|
|
class Meta:
|
|
model = SupplierOrder
|
|
fields = ("date", "number", "organization", "supplier", "currency", "rate", "author")
|
|
|
|
|
|
class CashInflowForm(forms.ModelForm):
|
|
class Meta:
|
|
model = CashInflow
|
|
fields = ("date", "number", "recipient", "amount", "customer_order", "comment", "author")
|
|
|
|
|
|
class CashTransferForm(forms.ModelForm):
|
|
class Meta:
|
|
model = CashTransfer
|
|
fields = ("date", "number", "sender", "recipient", "amount", "comment", "author")
|
|
|
|
|
|
class CashExpenseForm(forms.ModelForm):
|
|
class Meta:
|
|
model = CashExpense
|
|
fields = ("date", "number", "sender", "amount", "supplier_order", "comment", "author")
|