From 8ac3e4f84789d50a2c21ab101e66749cb71be205 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Tue, 14 Mar 2017 13:00:37 -0300 Subject: [PATCH] Seta a numeracao inicial na criacao do documento --- sapl/protocoloadm/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 77e0c0418..7f16f6d01 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -287,14 +287,15 @@ class CriarDocumentoProtocolo(PermissionRequiredMixin, CreateView): kwargs={'pk': self.kwargs['pk']}) def criar_documento(self, protocolo): + curr_year = datetime.now().date().year numero_max = DocumentoAdministrativo.objects.filter( - tipo=protocolo.tipo_documento + tipo=protocolo.tipo_documento, ano=curr_year ).aggregate(Max('numero'))['numero__max'] doc = {} doc['tipo'] = protocolo.tipo_documento - doc['ano'] = datetime.now().date().year + doc['ano'] = curr_year doc['data'] = protocolo.data doc['numero_protocolo'] = protocolo.numero doc['assunto'] = protocolo.assunto_ementa