Merge branch 'hotfix/employe_anterieur_fix_form_val_fix' into dev
authorBenoit C. Sirois <benoit.clennett-sirois@auf.org>
Tue, 16 Apr 2013 19:09:56 +0000 (15:09 -0400)
committerBenoit C. Sirois <benoit.clennett-sirois@auf.org>
Tue, 16 Apr 2013 19:09:56 +0000 (15:09 -0400)
1  2 
project/dae/forms.py

diff --combined project/dae/forms.py
@@@ -6,6 -6,7 +6,7 @@@ from dateutil.relativedelta import rela
  from django import forms
  from django.core.urlresolvers import reverse
  from django.core.exceptions import MultipleObjectsReturned
+ from django.forms.formsets import TOTAL_FORM_COUNT
  from django.forms.models import BaseInlineFormSet
  from django.forms.models import (
      inlineformset_factory,
@@@ -360,6 -361,15 +361,15 @@@ class ReadOnlyRemunForm(FlexibleRemunFo
  
  class GroupedInlineFormset(BaseInlineFormSet):
  
+     def total_form_count(self):
+         """Returns the total number of forms in this FormSet."""
+         if self.is_bound:
+             return self.management_form.cleaned_data[TOTAL_FORM_COUNT]
+         else:
+             return len(self.forms)
+         print total_forms
+         return total_forms
      def set_groups(self,
                     groups,
                     group_accessor,
@@@ -575,11 -585,7 +585,11 @@@ DossierCompReadOnlyRemunFormSet = remun
      parent_model=dae.DossierComparaison,
      model=dae.DossierComparaisonRemuneration,
      )
 -
 +RHReadOnlyRemunFormSet = remun_formset_factory_factory(
 +    read_only=True,
 +    parent_model=rh.Dossier,
 +    model=rh.Remuneration,
 +    )
  
  class PosteForm(filtered_archived_fields_form_factory(
          'classement_min',
@@@ -774,6 -780,7 +784,7 @@@ class DossierForm
          ),
      forms.ModelForm):
      """ Formulaire des dossiers. """
      class Meta:
          exclude = ('etat', 'employe', 'poste', 'date_debut',)
          model = dae.Dossier