|
@ -2,7 +2,6 @@ from datetime import datetime |
|
|
from random import choice |
|
|
from random import choice |
|
|
from string import ascii_letters, digits |
|
|
from string import ascii_letters, digits |
|
|
|
|
|
|
|
|
import weasyprint |
|
|
|
|
|
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 |
|
@ -20,8 +19,8 @@ from django.views.generic import CreateView, ListView, TemplateView, UpdateView |
|
|
from django.views.generic.base import RedirectView |
|
|
from django.views.generic.base import RedirectView |
|
|
from django.views.generic.edit import FormView |
|
|
from django.views.generic.edit import FormView |
|
|
from django_filters.views import FilterView |
|
|
from django_filters.views import FilterView |
|
|
|
|
|
import weasyprint |
|
|
|
|
|
|
|
|
import sapl |
|
|
|
|
|
from sapl.base.models import Autor, CasaLegislativa |
|
|
from sapl.base.models import Autor, CasaLegislativa |
|
|
from sapl.comissoes.models import Comissao, Participacao |
|
|
from sapl.comissoes.models import Comissao, Participacao |
|
|
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_RESTRICT, |
|
|
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_RESTRICT, |
|
@ -36,12 +35,15 @@ from sapl.materia.forms import (AnexadaForm, AutoriaForm, |
|
|
AutoriaMultiCreateForm, |
|
|
AutoriaMultiCreateForm, |
|
|
ConfirmarProposicaoForm, LegislacaoCitadaForm, |
|
|
ConfirmarProposicaoForm, LegislacaoCitadaForm, |
|
|
ProposicaoForm, TipoProposicaoForm, |
|
|
ProposicaoForm, TipoProposicaoForm, |
|
|
TramitacaoForm, TramitacaoUpdateForm) |
|
|
TramitacaoForm, TramitacaoUpdateForm, |
|
|
|
|
|
DevolverProposicaoForm) |
|
|
from sapl.norma.models import LegislacaoCitada |
|
|
from sapl.norma.models import LegislacaoCitada |
|
|
from sapl.protocoloadm.models import Protocolo |
|
|
from sapl.protocoloadm.models import Protocolo |
|
|
from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, |
|
|
from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, |
|
|
autor_modal, gerar_hash_arquivo, get_base_url, |
|
|
autor_modal, gerar_hash_arquivo, get_base_url, |
|
|
montar_row_autor, show_results_filter_set, get_mime_type_from_file_extension) |
|
|
montar_row_autor, show_results_filter_set, get_mime_type_from_file_extension) |
|
|
|
|
|
import sapl |
|
|
|
|
|
|
|
|
from .email_utils import do_envia_email_confirmacao |
|
|
from .email_utils import do_envia_email_confirmacao |
|
|
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, |
|
|
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, |
|
|
AdicionarVariasAutoriasFilterSet, DespachoInicialForm, |
|
|
AdicionarVariasAutoriasFilterSet, DespachoInicialForm, |
|
@ -61,6 +63,7 @@ from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria, |
|
|
TipoProposicao, Tramitacao, UnidadeTramitacao) |
|
|
TipoProposicao, Tramitacao, UnidadeTramitacao) |
|
|
from .signals import tramitacao_signal |
|
|
from .signals import tramitacao_signal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AssuntoMateriaCrud = Crud.build(AssuntoMateria, 'assunto_materia') |
|
|
AssuntoMateriaCrud = Crud.build(AssuntoMateria, 'assunto_materia') |
|
|
|
|
|
|
|
|
OrigemCrud = Crud.build(Origem, '') |
|
|
OrigemCrud = Crud.build(Origem, '') |
|
@ -469,7 +472,7 @@ class ConfirmarProposicao(PermissionRequiredForAppCrudMixin, UpdateView): |
|
|
app_label = sapl.protocoloadm.apps.AppConfig.label |
|
|
app_label = sapl.protocoloadm.apps.AppConfig.label |
|
|
template_name = "materia/confirmar_proposicao.html" |
|
|
template_name = "materia/confirmar_proposicao.html" |
|
|
model = Proposicao |
|
|
model = Proposicao |
|
|
form_class = ConfirmarProposicaoForm |
|
|
form_class = ConfirmarProposicaoForm, DevolverProposicaoForm |
|
|
|
|
|
|
|
|
def get_success_url(self): |
|
|
def get_success_url(self): |
|
|
msgs = self.object.results['messages'] |
|
|
msgs = self.object.results['messages'] |
|
@ -491,11 +494,9 @@ class ConfirmarProposicao(PermissionRequiredForAppCrudMixin, UpdateView): |
|
|
data_envio__isnull=False, |
|
|
data_envio__isnull=False, |
|
|
data_recebimento__isnull=True) |
|
|
data_recebimento__isnull=True) |
|
|
self.object = None |
|
|
self.object = None |
|
|
# FIXME implementar hash para texto eletrônico |
|
|
|
|
|
|
|
|
|
|
|
if proposicao.texto_articulado.exists(): |
|
|
if proposicao.texto_articulado.exists(): |
|
|
ta = proposicao.texto_articulado.first() |
|
|
ta = proposicao.texto_articulado.first() |
|
|
# FIXME hash para textos articulados |
|
|
|
|
|
hasher = 'P' + ta.hash() + '/' + str(proposicao.id) |
|
|
hasher = 'P' + ta.hash() + '/' + str(proposicao.id) |
|
|
else: |
|
|
else: |
|
|
hasher = gerar_hash_arquivo( |
|
|
hasher = gerar_hash_arquivo( |
|
@ -517,6 +518,21 @@ class ConfirmarProposicao(PermissionRequiredForAppCrudMixin, UpdateView): |
|
|
context['subnav_template_name'] = '' |
|
|
context['subnav_template_name'] = '' |
|
|
return context |
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
def get_form(self, form_class=None): |
|
|
|
|
|
if form_class is None: |
|
|
|
|
|
form_class = self.get_form_class() |
|
|
|
|
|
|
|
|
|
|
|
if self.request.POST: |
|
|
|
|
|
if 'justificativa_devolucao' in self.request.POST: |
|
|
|
|
|
return form_class[1](**self.get_form_kwargs()) |
|
|
|
|
|
else: |
|
|
|
|
|
return form_class[0](**self.get_form_kwargs()) |
|
|
|
|
|
else: |
|
|
|
|
|
forms = [] |
|
|
|
|
|
for form in form_class: |
|
|
|
|
|
forms.append(form(**self.get_form_kwargs())) |
|
|
|
|
|
return forms |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UnidadeTramitacaoCrud(CrudAux): |
|
|
class UnidadeTramitacaoCrud(CrudAux): |
|
|
model = UnidadeTramitacao |
|
|
model = UnidadeTramitacao |
|
|