Feature: компактные формы заказов, колонки Товар/Количество
Made-with: Cursor
This commit is contained in:
@@ -11,9 +11,29 @@ from .models import (
|
||||
)
|
||||
from django.forms import inlineformset_factory
|
||||
|
||||
|
||||
class CustomerOrderItemForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = CustomerOrderItem
|
||||
fields = ("product", "price", "currency", "quantity")
|
||||
widgets = {
|
||||
"quantity": forms.NumberInput(attrs={"size": 3, "min": 0, "max": 99, "style": "width: 4ch"}),
|
||||
}
|
||||
|
||||
|
||||
class SupplierOrderItemForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = SupplierOrderItem
|
||||
fields = ("product", "price", "currency", "quantity")
|
||||
widgets = {
|
||||
"quantity": forms.NumberInput(attrs={"size": 3, "min": 0, "max": 99, "style": "width: 4ch"}),
|
||||
}
|
||||
|
||||
|
||||
CustomerOrderItemFormSet = inlineformset_factory(
|
||||
CustomerOrder,
|
||||
CustomerOrderItem,
|
||||
form=CustomerOrderItemForm,
|
||||
fields=("product", "price", "currency", "quantity"),
|
||||
extra=1,
|
||||
can_delete=True,
|
||||
@@ -22,6 +42,7 @@ CustomerOrderItemFormSet = inlineformset_factory(
|
||||
SupplierOrderItemFormSet = inlineformset_factory(
|
||||
SupplierOrder,
|
||||
SupplierOrderItem,
|
||||
form=SupplierOrderItemForm,
|
||||
fields=("product", "price", "currency", "quantity"),
|
||||
extra=1,
|
||||
can_delete=True,
|
||||
@@ -32,12 +53,20 @@ class CustomerOrderForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = CustomerOrder
|
||||
fields = ("date", "number", "order_kind", "organization", "client", "author")
|
||||
widgets = {
|
||||
"date": forms.DateInput(attrs={"size": 10}),
|
||||
"number": forms.TextInput(attrs={"size": 15, "maxlength": 15}),
|
||||
}
|
||||
|
||||
|
||||
class SupplierOrderForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = SupplierOrder
|
||||
fields = ("date", "number", "organization", "supplier", "currency", "rate", "author")
|
||||
widgets = {
|
||||
"date": forms.DateInput(attrs={"size": 10}),
|
||||
"number": forms.TextInput(attrs={"size": 15, "maxlength": 15}),
|
||||
}
|
||||
|
||||
|
||||
class CashInflowForm(forms.ModelForm):
|
||||
|
||||
Reference in New Issue
Block a user