Browse Source

Mostra matéria/documento vinculado ao protocolo

pull/788/head
Eduardo Edson Batista Cordeiro Alves 8 years ago
parent
commit
d72ee09fce
  1. 4
      sapl/materia/forms.py
  2. 4
      sapl/materia/views.py
  3. 4
      sapl/protocoloadm/forms.py
  4. 21
      sapl/protocoloadm/views.py
  5. 19
      sapl/templates/protocoloadm/protocolo_mostrar.html

4
sapl/materia/forms.py

@ -72,13 +72,13 @@ class MateriaSimplificadaForm(ModelForm):
class Meta: class Meta:
model = MateriaLegislativa model = MateriaLegislativa
fields = ['tipo', 'numero', 'ano', 'data_apresentacao', fields = ['tipo', 'numero', 'ano', 'data_apresentacao',
'numero_origem_externa', 'regime_tramitacao', 'numero_protocolo', 'regime_tramitacao',
'em_tramitacao', 'ementa', 'texto_original'] 'em_tramitacao', 'ementa', 'texto_original']
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
row1 = to_row([('tipo', 6), ('numero', 3), ('ano', 3)]) row1 = to_row([('tipo', 6), ('numero', 3), ('ano', 3)])
row2 = to_row([('data_apresentacao', 6), ('numero_origem_externa', 6)]) row2 = to_row([('data_apresentacao', 6), ('numero_protocolo', 6)])
row3 = to_row([('regime_tramitacao', 6), ('em_tramitacao', 6)]) row3 = to_row([('regime_tramitacao', 6), ('em_tramitacao', 6)])
row4 = to_row([('ementa', 12)]) row4 = to_row([('ementa', 12)])
row5 = to_row([('texto_original', 12)]) row5 = to_row([('texto_original', 12)])

4
sapl/materia/views.py

@ -1,7 +1,6 @@
from datetime import datetime from datetime import datetime
from random import choice from random import choice
from string import ascii_letters, digits from string import ascii_letters, digits
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML from crispy_forms.layout import HTML
from django.contrib import messages from django.contrib import messages
@ -87,8 +86,7 @@ class CriarProtocoloMateriaView(CreateView):
context['form'].fields['numero'].initial = protocolo.numero context['form'].fields['numero'].initial = protocolo.numero
context['form'].fields['ano'].initial = protocolo.ano context['form'].fields['ano'].initial = protocolo.ano
context['form'].fields['data_apresentacao'].initial = protocolo.data context['form'].fields['data_apresentacao'].initial = protocolo.data
context['form'].fields[ context['form'].fields['numero_protocolo'].initial = protocolo.numero
'numero_origem_externa'].initial = protocolo.numero
context['form'].fields['ementa'].initial = protocolo.observacao context['form'].fields['ementa'].initial = protocolo.observacao
return context return context

4
sapl/protocoloadm/forms.py

@ -553,6 +553,10 @@ class DocumentoAdministrativoForm(ModelForm):
'texto_integral', 'texto_integral',
] ]
def save(self, commit=True):
documento = super(DocumentoAdministrativoForm, self).save(commit)
return documento
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
row1 = to_row( row1 = to_row(

21
sapl/protocoloadm/views.py

@ -3,6 +3,7 @@ from datetime import date, datetime
from braces.views import FormValidMessageMixin from braces.views import FormValidMessageMixin
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db.models import Max from django.db.models import Max
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
@ -14,7 +15,7 @@ from django_filters.views import FilterView
import sapl import sapl
from sapl.crud.base import Crud, CrudAux, MasterDetailCrud, make_pagination from sapl.crud.base import Crud, CrudAux, MasterDetailCrud, make_pagination
from sapl.materia.models import TipoMateriaLegislativa from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.utils import create_barcode, get_client_ip from sapl.utils import create_barcode, get_client_ip
from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
@ -274,6 +275,24 @@ class ProtocoloMostrarView(PermissionRequiredMixin, TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(ProtocoloMostrarView, self).get_context_data(**kwargs) context = super(ProtocoloMostrarView, self).get_context_data(**kwargs)
protocolo = Protocolo.objects.get(pk=self.kwargs['pk']) protocolo = Protocolo.objects.get(pk=self.kwargs['pk'])
if protocolo.tipo_materia:
try:
materia = MateriaLegislativa.objects.get(
numero_protocolo=protocolo.numero, ano=protocolo.ano)
except ObjectDoesNotExist:
context['materia'] = None
else:
context['materia'] = materia
elif protocolo.tipo_documento:
try:
documento = DocumentoAdministrativo.objects.get(
numero_protocolo=protocolo.numero, ano=protocolo.ano)
except ObjectDoesNotExist:
context['documento'] = None
else:
context['documento'] = documento
context['protocolo'] = protocolo context['protocolo'] = protocolo
return context return context

19
sapl/templates/protocoloadm/protocolo_mostrar.html

@ -15,14 +15,27 @@
<br /> <br />
<strong>Documento Vinculado:</strong></br> <strong>Documento Vinculado:</strong>
{% if protocolo.tipo_documento %} {% if protocolo.tipo_documento %}
<a href="{% url 'sapl.protocoloadm:criar_documento' protocolo.pk %}" class="btn btn-primary">Criar Documento</a> {% if documento %}
<a href="{% url 'sapl.protocoloadm:documentoadministrativo_detail' documento.pk %}"> {{documento}} </a>
</br>
{% else %}
<br />
<a href="{% url 'sapl.protocoloadm:criar_documento' protocolo.pk %}" class="btn btn-primary">Criar Documento</a>
{% endif %}
{% elif protocolo.tipo_materia %} {% elif protocolo.tipo_materia %}
<a href="{% url 'sapl.materia:materia_create_simplificado' protocolo.pk %}" class="btn btn-primary">Criar Matéria</a> {% if materia %}
<a href="{% url 'sapl.materia:materialegislativa_detail' materia.pk %}"> {{materia}} </a>
</br>
{% else %}
<br />
<a href="{% url 'sapl.materia:materia_create_simplificado' protocolo.pk %}" class="btn btn-primary">Criar Matéria</a>
{% endif %}
{% endif %} {% endif %}
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
<a target="popup" class="btn btn-primary" onclick="window.open('{% url 'sapl.protocoloadm:comprovante_protocolo' protocolo.pk%}','Comprovante','width=800, height=600')">Comprovante <a target="popup" class="btn btn-primary" onclick="window.open('{% url 'sapl.protocoloadm:comprovante_protocolo' protocolo.pk%}','Comprovante','width=800, height=600')">Comprovante
</a> </a>

Loading…
Cancel
Save