diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index f7308f62e..5d36ba99a 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -86,7 +86,8 @@ class SessaoPlenariaForm(ModelForm): sessoes = SessaoPlenaria.objects.filter(numero=num, sessao_legislativa=sl, legislatura=leg, - tipo=tipo).\ + tipo=tipo, + data_inicio__year=abertura.year).\ values_list('id', flat=True) qtd_sessoes = len(sessoes) diff --git a/sapl/sessao/tests/test_sessao.py b/sapl/sessao/tests/test_sessao.py index 1715cd0ae..c1af4fc7e 100644 --- a/sapl/sessao/tests/test_sessao.py +++ b/sapl/sessao/tests/test_sessao.py @@ -51,17 +51,17 @@ def test_numero_duplicado_sessao_plenaria_form(): legislatura = mommy.make(Legislatura) sessao = mommy.make(SessaoLegislativa) tipo = mommy.make(TipoSessaoPlenaria) - mommy.make(SessaoPlenaria, - legislatura=legislatura, - sessao_legislativa=sessao, - tipo=tipo, - numero=1) + sessao_plenaria = mommy.make(SessaoPlenaria, + legislatura=legislatura, + sessao_legislativa=sessao, + tipo=tipo, + numero=1) form = forms.SessaoPlenariaForm(data={'legislatura': str(legislatura.pk), 'numero': '1', 'tipo': str(tipo.pk), 'sessao_legislativa': str(sessao.pk), - 'data_inicio': '10/11/2017', + 'data_inicio': sessao_plenaria.data_inicio, 'hora_inicio': '10:10' })