From 0e54d17c777f160c93fe7ebf67e1dc111c133e7d Mon Sep 17 00:00:00 2001 From: Edward Date: Mon, 25 Jun 2018 09:44:43 -0300 Subject: [PATCH] Fixes #2038 (#2039) --- sapl/materia/forms.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 20518cfdd..838b8616d 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -1818,7 +1818,19 @@ class ConfirmarProposicaoForm(ProposicaoForm): if numeracao == 'A': nm = Protocolo.objects.filter( ano=timezone.now().year).aggregate(Max('numero')) - elif numeracao == 'U': + elif numeracao == 'L': + legislatura = Legislatura.objects.filter( + data_inicio__year__lte=timezone.now().year, + data_fim__year__gte=timezone.now().year).first() + data_inicio = legislatura.data_inicio + data_fim = legislatura.data_fim + nm = MateriaLegislativa.objects.filter( + data_apresentacao__gte=data_inicio, + data_apresentacao__lte=data_fim, + tipo=tipo).aggregate(Max('numero')) + + else: + # numeracao == 'U' ou não informada nm = Protocolo.objects.all().aggregate(Max('numero')) protocolo = Protocolo()