Project

General

Profile

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

calebasse / calebasse / actes / forms.py @ 48091f78

1 7d7d5da8 Benjamin Dauvergne
# -*- coding: utf-8 -*-
2 5ae15fa7 Benjamin Dauvergne
3 7d7d5da8 Benjamin Dauvergne
from django import forms
4 5ae15fa7 Benjamin Dauvergne
5 eb086941 Jérôme Schneider
from calebasse.actes.models import Act
6 8c58c98a Mikaël Ates
from calebasse.ressources.models import ActType
7 48a85f96 Jérôme Schneider
from ajax_select import make_ajax_field
8 eb086941 Jérôme Schneider
9 7d7d5da8 Benjamin Dauvergne
class ActSearchForm(forms.Form):
10
    STATES = (
11 981abc28 Jérôme Schneider
            ('pointe', u'Pointés'),
12
            ('non-pointe', u'Non pointés'),
13 05a6bb20 Mikaël Ates
            ('valide', u'Présents'),
14 c420645c Mikaël Ates
            ('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 7d7d5da8 Benjamin Dauvergne
            ('lost', u'Perdus'),
19 c420645c Mikaël Ates
            ('pause-invoicing', u'En pause facturation'),
20
            ('invoiced', u'Facturés'),
21 9b1f1c3a Serghei MIHAI
            ('group', u'De groupe'),
22 8416b9da Jérôme Schneider
#            ('current-invoicing', u'Facturation en cours')
23 36dd6ab2 Jérôme Schneider
            )
24 5ae15fa7 Benjamin Dauvergne
25 7d7d5da8 Benjamin Dauvergne
    INITIAL = [x[0] for x in STATES]
26 5ae15fa7 Benjamin Dauvergne
27 7d7d5da8 Benjamin Dauvergne
    last_name = forms.CharField(required=False)
28
    patient_record_id = forms.IntegerField(required=False)
29
    social_security_number = forms.CharField(required=False)
30
31
    doctor_name = forms.CharField(required=False)
32
    filters = forms.MultipleChoiceField(choices=STATES,
33 8416b9da Jérôme Schneider
            widget=forms.CheckboxSelectMultiple)
34 eb086941 Jérôme Schneider
35
class ActUpdate(forms.ModelForm):
36 48a85f96 Jérôme Schneider
    doctors = make_ajax_field(Act, 'doctors', 'intervenant', True)
37 eb086941 Jérôme Schneider
    class Meta:
38
        model = Act
39 05a6bb20 Mikaël Ates
        fields = ('act_type', 'doctors', 'is_lost', 'pause',
40 48091f78 Mikaël Ates
            'switch_billable', )
41 8c58c98a Mikaël Ates
42
    def __init__(self, instance, service=None, **kwargs):
43
        super(ActUpdate, self).__init__(instance=instance, **kwargs)
44
        if instance.patient.service:
45
            self.fields['act_type'].queryset = \
46
                    ActType.objects.for_service(instance.patient.service) \
47
                    .order_by('name')