Browse Source

Adiciona filtros de convênios na lista de serviços

pull/165/head
Sesostris Vieira 2 years ago
parent
commit
d017ad3b3e
  1. 32
      sigi/apps/servicos/admin.py

32
sigi/apps/servicos/admin.py

@ -7,13 +7,23 @@ from django.utils.translation import gettext as _
from import_export.fields import Field from import_export.fields import Field
from sigi.apps.casas.admin import GerentesInterlegisFilter from sigi.apps.casas.admin import GerentesInterlegisFilter
from sigi.apps.servicos.models import Servico, LogServico, TipoServico from sigi.apps.servicos.models import Servico, LogServico, TipoServico
from sigi.apps.servicos.filters import ServicoAtivoFilter, DataUtimoUsoFilter from sigi.apps.servicos.filters import (
ServicoAtivoFilter,
DataUtimoUsoFilter,
)
from sigi.apps.convenios.filters import (
TipoProjetoFilter,
ExcluirTipoProjetoFilter,
)
from sigi.apps.utils.filters import DateRangeFilter from sigi.apps.utils.filters import DateRangeFilter
from sigi.apps.utils.mixins import ReturnMixin, CartExportMixin, LabeledResourse from sigi.apps.utils.mixins import (
ReturnMixin,
CartExportMixin,
ValueLabeledResource,
)
class ServicoExportResourse(LabeledResourse): class ServicoExportResourse(ValueLabeledResource):
telefone_casa = Field(column_name="Casa Legislativa/telefone")
hospedagem_interlegis = Field(column_name="hospedagem no interlegis") hospedagem_interlegis = Field(column_name="hospedagem no interlegis")
class Meta: class Meta:
@ -23,7 +33,7 @@ class ServicoExportResourse(LabeledResourse):
"casa_legislativa__municipio__nome", "casa_legislativa__municipio__nome",
"casa_legislativa__municipio__uf__sigla", "casa_legislativa__municipio__uf__sigla",
"casa_legislativa__email", "casa_legislativa__email",
"telefone_casa", "casa_legislativa__telefone_geral",
"tipo_servico__nome", "tipo_servico__nome",
"url", "url",
"hospedagem_interlegis", "hospedagem_interlegis",
@ -32,14 +42,16 @@ class ServicoExportResourse(LabeledResourse):
"motivo_desativacao", "motivo_desativacao",
"data_ultimo_uso", "data_ultimo_uso",
"erro_atualizacao", "erro_atualizacao",
"casa_legislativa__convenio__projeto__sigla",
"casa_legislativa__convenio__num_convenio",
"casa_legislativa__convenio__num_processo_sf",
"casa_legislativa__convenio__data_retorno_assinatura",
"casa_legislativa__convenio__data_termino_vigencia",
) )
export_order = fields export_order = fields
def dehydrate_telefone_casa(self, servico):
return force_str(servico.casa_legislativa.telefone)
def dehydrate_hospedagem_interlegis(self, servico): def dehydrate_hospedagem_interlegis(self, servico):
if servico.hospedagem_interlegis: if servico["hospedagem_interlegis"]:
return _("Sim") return _("Sim")
else: else:
return _("Não") return _("Não")
@ -105,6 +117,8 @@ class ServicoAdmin(ReturnMixin, CartExportMixin, admin.ModelAdmin):
DataUtimoUsoFilter, DataUtimoUsoFilter,
("casa_legislativa__gerentes_interlegis", GerentesInterlegisFilter), ("casa_legislativa__gerentes_interlegis", GerentesInterlegisFilter),
"casa_legislativa__municipio__uf", "casa_legislativa__municipio__uf",
("casa_legislativa__convenio__projeto_id", TipoProjetoFilter),
("casa_legislativa__convenio__projeto_id", ExcluirTipoProjetoFilter),
) )
ordering = ( ordering = (
"casa_legislativa__municipio__uf", "casa_legislativa__municipio__uf",

Loading…
Cancel
Save