From 408842969dc20f7fed6d75d0208a2e91d47c431c Mon Sep 17 00:00:00 2001 From: Mariana Mendes Date: Thu, 1 Nov 2018 07:42:31 -0300 Subject: [PATCH] FIX #2293 (#2295) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #2293 * fix #2293 * fix #2293 * fix #2293 * Corrige as migrações para evitar conflito --- sapl/materia/forms.py | 8 +++++- .../migrations/0033_auto_20181030_1039.py | 25 +++++++++++++++++++ sapl/materia/models.py | 6 +++++ sapl/materia/views.py | 2 +- sapl/parlamentares/views.py | 7 +++++- sapl/templates/materia/layouts.yaml | 1 + sapl/templates/materia/proposicao_detail.html | 14 +++++++++++ 7 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 sapl/materia/migrations/0033_auto_20181030_1039.py diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 76a82b7c7..c3ce1f36f 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -1329,6 +1329,7 @@ class ProposicaoForm(forms.ModelForm): fields = ['tipo', 'receber_recibo', 'descricao', + 'observacao', 'texto_original', 'materia_de_vinculo', @@ -1365,6 +1366,7 @@ class ProposicaoForm(forms.ModelForm): css_class="ementa_materia hidden alert-info", dismiss=False), 12)), to_column(('descricao', 12)), + to_column(('observacao', 12)), ] @@ -1507,6 +1509,7 @@ class DevolverProposicaoForm(forms.ModelForm): model = Proposicao fields = [ 'justificativa_devolucao', + 'observacao', ] def __init__(self, *args, **kwargs): @@ -1519,6 +1522,7 @@ class DevolverProposicaoForm(forms.ModelForm): Fieldset( _('Registro de Devolução'), to_column(('justificativa_devolucao', 12)), + to_column(('observacao', 12)), to_column( (form_actions(label=_('Devolver'), name='devolver', @@ -1600,6 +1604,7 @@ class ConfirmarProposicaoForm(ProposicaoForm): fields = [ 'data_envio', 'descricao', + 'observacao', 'gerar_protocolo', 'numero_de_paginas' ] @@ -1653,7 +1658,8 @@ class ConfirmarProposicaoForm(ProposicaoForm): to_column(('tipo_readonly', 4)), to_column(('data_envio', 3)), to_column(('autor_readonly', 5)), - to_column(('descricao', 12)))] + to_column(('descricao', 12)), + to_column(('observacao', 12)))] fields.append( Fieldset(_('Vinculado a Matéria Legislativa'), diff --git a/sapl/materia/migrations/0033_auto_20181030_1039.py b/sapl/materia/migrations/0033_auto_20181030_1039.py new file mode 100644 index 000000000..f8695cc57 --- /dev/null +++ b/sapl/materia/migrations/0033_auto_20181030_1039.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2018-10-30 12:39 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0032_auto_20181022_1743'), + ] + + operations = [ + migrations.AddField( + model_name='proposicao', + name='cancelado', + field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Cancelada ?'), + ), + migrations.AddField( + model_name='proposicao', + name='observacao', + field=models.TextField(blank=True, verbose_name='Observação'), + ), + ] diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 3c1b4862e..b3dfc1671 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -280,6 +280,7 @@ class MateriaLegislativa(models.Model): for p in self.proposicao.all(): p.conteudo_gerado_related = None + p.cancelado = True p.save() return models.Model.delete( @@ -725,6 +726,11 @@ class Proposicao(models.Model): blank=True, null=True, default=None) conteudo_gerado_related = SaplGenericForeignKey( 'content_type', 'object_id', verbose_name=_('Conteúdo Gerado')) + observacao = models.TextField( + blank=True, verbose_name=_('Observação')) + cancelado = models.BooleanField(verbose_name=_('Cancelada ?'), + choices=YES_NO_CHOICES, + default=False) """# Ao ser recebida, irá gerar uma nova matéria ou um documento acessorio # de uma já existente diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 6ab69d7d4..d38d73d50 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -704,7 +704,7 @@ class ProposicaoCrud(Crud): class BaseMixin(Crud.BaseMixin): list_field_names = ['data_envio', 'data_recebimento', 'descricao', - 'tipo', 'conteudo_gerado_related'] + 'tipo', 'conteudo_gerado_related', 'cancelado', ] class BaseLocalMixin: form_class = ProposicaoForm diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index fb98cce73..9e6fc1d17 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -129,10 +129,15 @@ class ProposicaoParlamentarCrud(CrudBaseForListAndDetailExternalAppView): def get_queryset(self): return super().get_queryset().filter( data_envio__isnull=False, - data_recebimento__isnull=False) + data_recebimento__isnull=False, + cancelado=False) class DetailView(CrudBaseForListAndDetailExternalAppView.DetailView): + def get_queryset(self): + return super().get_queryset().filter( + cancelado=False) + @property def extras_url(self): diff --git a/sapl/templates/materia/layouts.yaml b/sapl/templates/materia/layouts.yaml index 7c0c17e4e..26d603f99 100644 --- a/sapl/templates/materia/layouts.yaml +++ b/sapl/templates/materia/layouts.yaml @@ -93,6 +93,7 @@ Proposicao: {% trans 'Proposição' %}: - tipo data_envio - descricao + - observacao {% trans 'Materia' %}: - materia_de_vinculo {% trans 'Complemento' %}: diff --git a/sapl/templates/materia/proposicao_detail.html b/sapl/templates/materia/proposicao_detail.html index 5690b6437..9ab80ab62 100644 --- a/sapl/templates/materia/proposicao_detail.html +++ b/sapl/templates/materia/proposicao_detail.html @@ -111,6 +111,20 @@ + + {% if object.observacao %} +
+
+
+

{%field_verbose_name object 'observacao'%}

+
+
{{object.observacao}}
+
+
+
+
+ {% endif %} +
{% if object.conteudo_gerado_related %}