Project

General

Profile

Download (1.79 KB) Statistics
| Branch: | Tag: | Revision:

calebasse / calebasse / actes / forms.py @ c1819ffb

1
# -*- coding: utf-8 -*-
2

    
3
from django import forms
4

    
5
from calebasse.actes.models import Act
6
from calebasse.ressources.models import ActType
7
from ajax_select import make_ajax_field
8

    
9
class ActSearchForm(forms.Form):
10
    STATES = (
11
            ('pointe', u'Pointés'),
12
            ('non-pointe', u'Non pointés'),
13
            ('valide', u'Validés'),
14
            ('absent-or-canceled', u'Absents ou annulés'),
15
            ('is-billable', u'Facturables'),
16
            ('non-invoicable', u'Non facturables'),
17
            ('switch-billable', u'Avec facturabilité inversée'),
18
            ('lost', u'Perdus'),
19
            ('pause-invoicing', u'En pause facturation'),
20
            ('invoiced', u'Facturés'),
21
#            ('current-invoicing', u'Facturation en cours')
22
            )
23

    
24
    INITIAL = [x[0] for x in STATES]
25

    
26
    last_name = forms.CharField(required=False)
27
    patient_record_id = forms.IntegerField(required=False)
28
    social_security_number = forms.CharField(required=False)
29

    
30
    doctor_name = forms.CharField(required=False)
31
    filters = forms.MultipleChoiceField(choices=STATES,
32
            widget=forms.CheckboxSelectMultiple)
33

    
34
class ActUpdate(forms.ModelForm):
35
    doctors = make_ajax_field(Act, 'doctors', 'intervenant', True)
36
    class Meta:
37
        model = Act
38
        fields = ('act_type', 'doctors', 'is_lost', 'pause', 'switch_billable', 'comment',
39
                'valide')
40
        widgets = {
41
                'comment': forms.Textarea(attrs={'cols': 52, 'rows': 4}),
42
                }
43

    
44
    def __init__(self, instance, service=None, **kwargs):
45
        super(ActUpdate, self).__init__(instance=instance, **kwargs)
46
        if instance.patient.service:
47
            self.fields['act_type'].queryset = \
48
                    ActType.objects.for_service(instance.patient.service) \
49
                    .order_by('name')
(3-3/9)