mvp
This commit is contained in:
+26
-4
@@ -1,8 +1,12 @@
|
||||
from django import forms
|
||||
from django.contrib.auth.models import User, Group
|
||||
from .models import Expense, Project, Category, SystemSetting, UserProfile, Document, CurrencyEnum, ExpenseTypeEnum, Vendor
|
||||
from .models import Expense, Project, Category, SystemSetting, UserProfile, Document, CurrencyEnum, ExpenseTypeEnum, Vendor, VehicleOwnershipEnum
|
||||
from .chile_regions import REGION_CHOICES, COMMUNE_CHOICES
|
||||
|
||||
|
||||
class MultipleFileInput(forms.FileInput):
|
||||
allow_multiple_selected = True
|
||||
|
||||
class ExpenseForm(forms.ModelForm):
|
||||
date = forms.DateField(
|
||||
widget=forms.DateInput(attrs={'type': 'date'}),
|
||||
@@ -16,9 +20,27 @@ class ExpenseForm(forms.ModelForm):
|
||||
)
|
||||
|
||||
receipt = forms.FileField(
|
||||
label='Adjuntar Boleta/Factura',
|
||||
label='Adjuntar Evidencia(s) (Boleta / Factura)',
|
||||
required=False,
|
||||
widget=forms.FileInput(attrs={'accept': 'image/*,.pdf'})
|
||||
widget=MultipleFileInput(attrs={'multiple': True, 'accept': 'image/*,.pdf'})
|
||||
)
|
||||
|
||||
region = forms.ChoiceField(
|
||||
choices=[('', '--- Seleccione Región ---')] + REGION_CHOICES,
|
||||
label='Región Operativa',
|
||||
required=False
|
||||
)
|
||||
|
||||
comuna = forms.ChoiceField(
|
||||
choices=[('', '--- Seleccione Comuna ---')] + COMMUNE_CHOICES,
|
||||
label='Comuna',
|
||||
required=False
|
||||
)
|
||||
|
||||
vehicle_ownership = forms.ChoiceField(
|
||||
choices=[('', '--- Seleccione Modalidad ---')] + VehicleOwnershipEnum.choices,
|
||||
label='Modalidad / Vehículo',
|
||||
required=False
|
||||
)
|
||||
|
||||
tax_amount_clp = forms.DecimalField(
|
||||
@@ -36,7 +58,7 @@ class ExpenseForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Expense
|
||||
fields = [
|
||||
'project', 'category', 'amount_clp', 'tax_type', 'tax_amount_clp', 'total_amount_clp', 'currency', 'date',
|
||||
'project', 'category', 'amount_clp', 'tax_type', 'tax_amount_clp', 'total_amount_clp', 'currency', 'responsible_person', 'date',
|
||||
'description', 'vendor', 'region', 'comuna', 'vehicle_ownership'
|
||||
]
|
||||
widgets = {
|
||||
|
||||
Reference in New Issue
Block a user