Browse Source

Remove import ipdb, adiciona logica a protocolo de materia

pull/3029/head
Edward Ribeiro 5 years ago
parent
commit
9baa64df32
  1. 17
      sapl/protocoloadm/views.py

17
sapl/protocoloadm/views.py

@ -542,7 +542,6 @@ class ProtocoloDocumentoView(PermissionRequiredMixin,
@transaction.atomic @transaction.atomic
def form_valid(self, form): def form_valid(self, form):
import ipdb; ipdb.set_trace()
protocolo = form.save(commit=False) protocolo = form.save(commit=False)
username = self.request.user.username username = self.request.user.username
@ -773,10 +772,22 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView):
data_fim__year__gte=timezone.now().year).first() data_fim__year__gte=timezone.now().year).first()
data_inicio = legislatura.data_inicio data_inicio = legislatura.data_inicio
data_fim = legislatura.data_fim data_fim = legislatura.data_fim
data_inicio_utc = from_date_to_datetime_utc(data_inicio)
data_fim_utc = from_date_to_datetime_utc(data_fim)
numero = Protocolo.objects.filter( numero = Protocolo.objects.filter(
Q(data__isnull=False,
data__gte=data_inicio, data__gte=data_inicio,
data__lte=data_fim).aggregate( data__lte=data_fim) |
Max('numero')) Q(timestamp__isnull=False,
timestamp__gte=data_inicio_utc,
timestamp__lte=data_fim_utc) |
Q(timestamp_data_hora_manual__isnull=False,
timestamp_data_hora_manual__gte=data_inicio_utc,
timestamp_data_hora_manual__lte=data_fim_utc,)).\
aggregate(Max('numero'))
elif numeracao == 'U': elif numeracao == 'U':
numero = Protocolo.objects.all().aggregate(Max('numero')) numero = Protocolo.objects.all().aggregate(Max('numero'))

Loading…
Cancel
Save