Docs: начальная структура проекта
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
58
app/documents/forms.py
Normal file
58
app/documents/forms.py
Normal file
@@ -0,0 +1,58 @@
|
||||
"""Формы документов."""
|
||||
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")
|
||||
Reference in New Issue
Block a user