|
@ -37,7 +37,7 @@ from sapl.protocoloadm.models import Protocolo |
|
|
from sapl.relatorios.views import relatorio_doc_administrativos |
|
|
from sapl.relatorios.views import relatorio_doc_administrativos |
|
|
from sapl.utils import (create_barcode, get_base_url, get_client_ip, |
|
|
from sapl.utils import (create_barcode, get_base_url, get_client_ip, |
|
|
get_mime_type_from_file_extension, lista_anexados, |
|
|
get_mime_type_from_file_extension, lista_anexados, |
|
|
show_results_filter_set, mail_service_configured) |
|
|
show_results_filter_set, mail_service_configured, from_date_to_datetime_utc) |
|
|
|
|
|
|
|
|
from .forms import (AcompanhamentoDocumentoForm, AnularProtocoloAdmForm, |
|
|
from .forms import (AcompanhamentoDocumentoForm, AnularProtocoloAdmForm, |
|
|
DocumentoAcessorioAdministrativoForm, |
|
|
DocumentoAcessorioAdministrativoForm, |
|
@ -542,6 +542,7 @@ 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 |
|
|
|
|
|
|
|
@ -564,12 +565,24 @@ class ProtocoloDocumentoView(PermissionRequiredMixin, |
|
|
legislatura = Legislatura.objects.filter( |
|
|
legislatura = Legislatura.objects.filter( |
|
|
data_inicio__year__lte=timezone.now().year, |
|
|
data_inicio__year__lte=timezone.now().year, |
|
|
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')) |
|
|
|
|
|
|
|
|