|
@ -1,8 +1,7 @@ |
|
|
|
|
|
|
|
|
import os |
|
|
|
|
|
from datetime import date, datetime |
|
|
from datetime import date, datetime |
|
|
|
|
|
import os |
|
|
|
|
|
|
|
|
import django_filters |
|
|
|
|
|
from crispy_forms.bootstrap import Alert, FormActions, InlineRadios |
|
|
from crispy_forms.bootstrap import Alert, FormActions, InlineRadios |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.layout import (HTML, Button, Column, Div, Field, Fieldset, |
|
|
from crispy_forms.layout import (HTML, Button, Column, Div, Field, Fieldset, |
|
@ -21,8 +20,8 @@ from django.utils.encoding import force_text |
|
|
from django.utils.html import format_html |
|
|
from django.utils.html import format_html |
|
|
from django.utils.safestring import mark_safe |
|
|
from django.utils.safestring import mark_safe |
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
|
|
|
import django_filters |
|
|
|
|
|
|
|
|
import sapl |
|
|
|
|
|
from sapl.base.models import Autor |
|
|
from sapl.base.models import Autor |
|
|
from sapl.comissoes.models import Comissao |
|
|
from sapl.comissoes.models import Comissao |
|
|
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC, |
|
|
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC, |
|
@ -40,6 +39,7 @@ from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, |
|
|
ChoiceWithoutValidationField, |
|
|
ChoiceWithoutValidationField, |
|
|
MateriaPesquisaOrderingFilter, RangeWidgetOverride, |
|
|
MateriaPesquisaOrderingFilter, RangeWidgetOverride, |
|
|
autor_label, autor_modal, models_with_gr_for_model) |
|
|
autor_label, autor_modal, models_with_gr_for_model) |
|
|
|
|
|
import sapl |
|
|
|
|
|
|
|
|
from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, |
|
|
from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, |
|
|
DocumentoAcessorio, Numeracao, Proposicao, Relatoria, |
|
|
DocumentoAcessorio, Numeracao, Proposicao, Relatoria, |
|
@ -165,6 +165,7 @@ class DocumentoAcessorioForm(ModelForm): |
|
|
model = DocumentoAcessorio |
|
|
model = DocumentoAcessorio |
|
|
fields = ['tipo', 'nome', 'data', 'autor', 'ementa', 'arquivo'] |
|
|
fields = ['tipo', 'nome', 'data', 'autor', 'ementa', 'arquivo'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RelatoriaForm(ModelForm): |
|
|
class RelatoriaForm(ModelForm): |
|
|
|
|
|
|
|
|
class Meta: |
|
|
class Meta: |
|
@ -1100,6 +1101,18 @@ class ConfirmarProposicaoForm(ProposicaoForm): |
|
|
if 'numero_de_paginas' not in self._meta.fields: |
|
|
if 'numero_de_paginas' not in self._meta.fields: |
|
|
self._meta.fields.append('numero_de_paginas') |
|
|
self._meta.fields.append('numero_de_paginas') |
|
|
|
|
|
|
|
|
|
|
|
self.instance = kwargs.get('instance', None) |
|
|
|
|
|
if not self.instance: |
|
|
|
|
|
raise ValueError(_('Erro na Busca por proposição a incorporar')) |
|
|
|
|
|
|
|
|
|
|
|
if self.instance.tipo.content_type.model_class() == TipoDocumento: |
|
|
|
|
|
if 'numero_de_paginas' in self._meta.fields: |
|
|
|
|
|
self._meta.fields.remove('numero_de_paginas') |
|
|
|
|
|
if 'gerar_protocolo' in self._meta.fields: |
|
|
|
|
|
self._meta.fields.remove('gerar_protocolo') |
|
|
|
|
|
if 'regime_tramitacao' in self._meta.fields: |
|
|
|
|
|
self._meta.fields.remove('regime_tramitacao') |
|
|
|
|
|
|
|
|
# esta chamada isola o __init__ de ProposicaoForm |
|
|
# esta chamada isola o __init__ de ProposicaoForm |
|
|
super(ProposicaoForm, self).__init__(*args, **kwargs) |
|
|
super(ProposicaoForm, self).__init__(*args, **kwargs) |
|
|
|
|
|
|
|
@ -1131,7 +1144,11 @@ class ConfirmarProposicaoForm(ProposicaoForm): |
|
|
css_class="ementa_materia hidden alert-info", |
|
|
css_class="ementa_materia hidden alert-info", |
|
|
dismiss=False), 12)))) |
|
|
dismiss=False), 12)))) |
|
|
|
|
|
|
|
|
|
|
|
itens_incorporacao = [] |
|
|
|
|
|
if self.instance.tipo.content_type.model_class() == \ |
|
|
|
|
|
TipoMateriaLegislativa: |
|
|
itens_incorporacao = [to_column(('regime_tramitacao', 4))] |
|
|
itens_incorporacao = [to_column(('regime_tramitacao', 4))] |
|
|
|
|
|
|
|
|
if self.proposicao_incorporacao_obrigatoria == 'C': |
|
|
if self.proposicao_incorporacao_obrigatoria == 'C': |
|
|
itens_incorporacao.append(to_column((InlineRadios( |
|
|
itens_incorporacao.append(to_column((InlineRadios( |
|
|
'gerar_protocolo'), 4))) |
|
|
'gerar_protocolo'), 4))) |
|
@ -1367,6 +1384,9 @@ class ConfirmarProposicaoForm(ProposicaoForm): |
|
|
proposicao.conteudo_gerado_related = conteudo_gerado |
|
|
proposicao.conteudo_gerado_related = conteudo_gerado |
|
|
proposicao.save() |
|
|
proposicao.save() |
|
|
|
|
|
|
|
|
|
|
|
if self.instance.tipo.content_type.model_class() == TipoDocumento: |
|
|
|
|
|
return self.instance |
|
|
|
|
|
|
|
|
# Nunca gerar protocolo |
|
|
# Nunca gerar protocolo |
|
|
if self.proposicao_incorporacao_obrigatoria == 'N': |
|
|
if self.proposicao_incorporacao_obrigatoria == 'N': |
|
|
return self.instance |
|
|
return self.instance |
|
|