1 | # File: ClassificacaoOrcamentaria.py |
---|
2 | # |
---|
3 | # Copyright (c) 2005 by Interlegis |
---|
4 | # Generator: ArchGenXML Version 1.4.0-beta2 devel |
---|
5 | # http://plone.org/products/archgenxml |
---|
6 | # |
---|
7 | # GNU General Public Licence (GPL) |
---|
8 | # |
---|
9 | # This program is free software; you can redistribute it and/or modify it under |
---|
10 | # the terms of the GNU General Public License as published by the Free Software |
---|
11 | # Foundation; either version 2 of the License, or (at your option) any later |
---|
12 | # version. |
---|
13 | # This program is distributed in the hope that it will be useful, but WITHOUT |
---|
14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
15 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
---|
16 | # details. |
---|
17 | # You should have received a copy of the GNU General Public License along with |
---|
18 | # this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
19 | # Place, Suite 330, Boston, MA 02111-1307 USA |
---|
20 | # |
---|
21 | __author__ = '''STC Interlegis <stc@interlegis.gov.br>''' |
---|
22 | __docformat__ = 'plaintext' |
---|
23 | |
---|
24 | |
---|
25 | from AccessControl import ClassSecurityInfo |
---|
26 | from Products.Archetypes.atapi import * |
---|
27 | from Products.ILSAALOrcamento.interfaces.IClassificacaoOrcamentaria import IClassificacaoOrcamentaria |
---|
28 | |
---|
29 | from Products.ATVocabularyManager.namedvocabulary import NamedVocabulary |
---|
30 | from Products.CMFCore.utils import getToolByName |
---|
31 | |
---|
32 | from Products.Archetypes.SQLStorage import * |
---|
33 | # additional imports from tagged value 'import' |
---|
34 | from Products.ILSAAL.saalapi import * |
---|
35 | |
---|
36 | from Products.ILSAALOrcamento.config import * |
---|
37 | ##code-section module-header #fill in your manual code here |
---|
38 | ##/code-section module-header |
---|
39 | |
---|
40 | schema=Schema(( |
---|
41 | StringField('nome_casa', |
---|
42 | widget=StringWidget( |
---|
43 | label="Codigo da Casa", |
---|
44 | label_msgid='ILSAALOrcamento_label_nome_casa', |
---|
45 | description_msgid='ILSAALOrcamento_help_nome_casa', |
---|
46 | i18n_domain='ILSAALOrcamento', |
---|
47 | ), |
---|
48 | default_method='getNomeCasa' |
---|
49 | ), |
---|
50 | |
---|
51 | StringField('cod_funcao', |
---|
52 | widget=SelectionWidget( |
---|
53 | label="Codigo da Funcao", |
---|
54 | description="Informe o codigo da funcao.", |
---|
55 | format="select", |
---|
56 | label_msgid='ILSAALOrcamento_label_cod_funcao', |
---|
57 | description_msgid='ILSAALOrcamento_help_cod_funcao', |
---|
58 | i18n_domain='ILSAALOrcamento', |
---|
59 | ), |
---|
60 | required=1, |
---|
61 | vocabulary=NamedVocabulary("""funcao"""), |
---|
62 | enforceVocabulary=1 |
---|
63 | ), |
---|
64 | |
---|
65 | StringField('cod_subfuncao', |
---|
66 | widget=SelectionWidget( |
---|
67 | label="Codigo da Subfuncao", |
---|
68 | description="Informe o codigo da funcao.", |
---|
69 | format="select", |
---|
70 | label_msgid='ILSAALOrcamento_label_cod_subfuncao', |
---|
71 | description_msgid='ILSAALOrcamento_help_cod_subfuncao', |
---|
72 | i18n_domain='ILSAALOrcamento', |
---|
73 | ), |
---|
74 | required=1, |
---|
75 | vocabulary=NamedVocabulary("""subfuncao"""), |
---|
76 | enforceVocabulary=1 |
---|
77 | ), |
---|
78 | |
---|
79 | StringField('cod_nivel', |
---|
80 | widget=StringWidget( |
---|
81 | label="Codigo do Nivel", |
---|
82 | description="Informe o codigo do nivel.", |
---|
83 | label_msgid='ILSAALOrcamento_label_cod_nivel', |
---|
84 | description_msgid='ILSAALOrcamento_help_cod_nivel', |
---|
85 | i18n_domain='ILSAALOrcamento', |
---|
86 | ), |
---|
87 | required=1 |
---|
88 | ), |
---|
89 | |
---|
90 | StringField('cod_lancamento', |
---|
91 | widget=StringWidget( |
---|
92 | label="Codigo do Lancamento", |
---|
93 | description="Informe o codigo do lancamento.", |
---|
94 | label_msgid='ILSAALOrcamento_label_cod_lancamento', |
---|
95 | description_msgid='ILSAALOrcamento_help_cod_lancamento', |
---|
96 | i18n_domain='ILSAALOrcamento', |
---|
97 | ), |
---|
98 | required=1 |
---|
99 | ), |
---|
100 | |
---|
101 | TextField('des_classificacao', |
---|
102 | widget=TextAreaWidget( |
---|
103 | description="Informe a descricao da classificacao orcamentaria.", |
---|
104 | label="Descricao da Classificacao Orcamentaria", |
---|
105 | label_msgid='ILSAALOrcamento_label_des_classificacao', |
---|
106 | description_msgid='ILSAALOrcamento_help_des_classificacao', |
---|
107 | i18n_domain='ILSAALOrcamento', |
---|
108 | ), |
---|
109 | required=1 |
---|
110 | ), |
---|
111 | |
---|
112 | StringField('cod_programa', |
---|
113 | widget=SelectionWidget( |
---|
114 | label="Codigo do Programa", |
---|
115 | description="Informe o codigo do programa.", |
---|
116 | format="select", |
---|
117 | label_msgid='ILSAALOrcamento_label_cod_programa', |
---|
118 | description_msgid='ILSAALOrcamento_help_cod_programa', |
---|
119 | i18n_domain='ILSAALOrcamento', |
---|
120 | ), |
---|
121 | required=1, |
---|
122 | vocabulary=NamedVocabulary("""programa"""), |
---|
123 | enforceVocabulary=1 |
---|
124 | ), |
---|
125 | |
---|
126 | StringField('cod_projeto_atividade', |
---|
127 | widget=SelectionWidget( |
---|
128 | label="Atividade", |
---|
129 | description="Informe o codigo da atividade.", |
---|
130 | format="select", |
---|
131 | label_msgid='ILSAALOrcamento_label_cod_projeto_atividade', |
---|
132 | description_msgid='ILSAALOrcamento_help_cod_projeto_atividade', |
---|
133 | i18n_domain='ILSAALOrcamento', |
---|
134 | ), |
---|
135 | required=1, |
---|
136 | vocabulary=NamedVocabulary("""projeto_atividade"""), |
---|
137 | enforceVocabulary=1 |
---|
138 | ), |
---|
139 | |
---|
140 | |
---|
141 | ReferenceField('cod_unidade_orcamentaria', |
---|
142 | widget=ReferenceWidget( |
---|
143 | label='Cod_unidade_orcamentaria', |
---|
144 | label_msgid='ILSAALOrcamento_label_cod_unidade_orcamentaria', |
---|
145 | description_msgid='ILSAALOrcamento_help_cod_unidade_orcamentaria', |
---|
146 | i18n_domain='ILSAALOrcamento', |
---|
147 | ), |
---|
148 | allowed_types=('UnidadeOrcamentaria',), |
---|
149 | multiValued=0, |
---|
150 | relationship='ClassificacaoOrcamentaria_UnidadeOrcamentaria' |
---|
151 | ), |
---|
152 | |
---|
153 | |
---|
154 | ReferenceField('cod_natureza_orcamento', |
---|
155 | widget=ReferenceWidget( |
---|
156 | label='Cod_natureza_orcamento', |
---|
157 | label_msgid='ILSAALOrcamento_label_cod_natureza_orcamento', |
---|
158 | description_msgid='ILSAALOrcamento_help_cod_natureza_orcamento', |
---|
159 | i18n_domain='ILSAALOrcamento', |
---|
160 | ), |
---|
161 | allowed_types=('NaturezaReceita', 'NaturezaDespesa'), |
---|
162 | multiValued=0, |
---|
163 | relationship='ClassificacaoOrcamentaria_NaturezaOrcamento' |
---|
164 | ), |
---|
165 | |
---|
166 | ), |
---|
167 | ) |
---|
168 | |
---|
169 | |
---|
170 | ##code-section after-local-schema #fill in your manual code here |
---|
171 | ##/code-section after-local-schema |
---|
172 | |
---|
173 | ClassificacaoOrcamentaria_schema = BaseFolderSchema + \ |
---|
174 | schema |
---|
175 | |
---|
176 | ##code-section after-schema #fill in your manual code here |
---|
177 | ##/code-section after-schema |
---|
178 | |
---|
179 | class ClassificacaoOrcamentaria(BaseFolder): |
---|
180 | """ |
---|
181 | Interface da classe ClassificacaoOrcamentaria |
---|
182 | """ |
---|
183 | security = ClassSecurityInfo() |
---|
184 | __implements__ = (getattr(BaseFolder,'__implements__',()),) + (IClassificacaoOrcamentaria,) |
---|
185 | |
---|
186 | |
---|
187 | # This name appears in the 'add' box |
---|
188 | archetype_name = 'ClassificacaoOrcamentaria' |
---|
189 | |
---|
190 | meta_type = 'ClassificacaoOrcamentaria' |
---|
191 | portal_type = 'ClassificacaoOrcamentaria' |
---|
192 | allowed_content_types = ['OrcamentoReal', 'OrcamentoSimulado'] |
---|
193 | filter_content_types = 1 |
---|
194 | global_allow = 0 |
---|
195 | allow_discussion = 0 |
---|
196 | #content_icon = 'ClassificacaoOrcamentaria.gif' |
---|
197 | immediate_view = 'base_view' |
---|
198 | default_view = 'base_view' |
---|
199 | suppl_views = () |
---|
200 | typeDescription = "ClassificacaoOrcamentaria" |
---|
201 | typeDescMsgId = 'description_edit_classificacaoorcamentaria' |
---|
202 | |
---|
203 | schema = ClassificacaoOrcamentaria_schema |
---|
204 | |
---|
205 | ##code-section class-header #fill in your manual code here |
---|
206 | ##/code-section class-header |
---|
207 | |
---|
208 | |
---|
209 | #Methods |
---|
210 | |
---|
211 | security.declarePublic('getCodClassificacao') |
---|
212 | def getCodClassificacao(self): |
---|
213 | """ |
---|
214 | Gera o Codigo dessa Classificacao Orcamentaria com base nos |
---|
215 | atributos que correspondem aos codigos. |
---|
216 | """ |
---|
217 | |
---|
218 | return self.getCod_orgao() + ':' + self.getCod_funcao() + ':' + self.getCod_subfuncao() \ |
---|
219 | + ':' + self.getCod_nivel() + ':' + self.getCod_lancamento() \ |
---|
220 | + ':' + self.getCod_programa() + ':' + self.getCod_projeto_atividade() |
---|
221 | |
---|
222 | |
---|
223 | security.declarePublic('getNomeCasa') |
---|
224 | def getNomeCasa(self): |
---|
225 | """ |
---|
226 | Pega o nome da casa Legislativa |
---|
227 | """ |
---|
228 | portal = getToolByName(self, 'portal_url').getPortalObject() |
---|
229 | |
---|
230 | return getToolByName(portal,'portal_saal').getNom_casa() |
---|
231 | |
---|
232 | |
---|
233 | #methods from Interface IClassificacaoOrcamentaria |
---|
234 | |
---|
235 | security.declarePrivate('_titulo') |
---|
236 | def _titulo(self): |
---|
237 | """ |
---|
238 | Configuracao do titulo que esse objeto deseja disponibilizar. |
---|
239 | """ |
---|
240 | |
---|
241 | return self.getCodClassificacao() + ':' + self.getDes_classificacao() |
---|
242 | |
---|
243 | |
---|
244 | #manually created methods |
---|
245 | |
---|
246 | def gerarListaNaturezas(self): |
---|
247 | """ |
---|
248 | Gera a lista que servira como dicionario para o parametro do |
---|
249 | Selection cod_natureza_orcamento |
---|
250 | """ |
---|
251 | |
---|
252 | return ('NaturezaDespesa',) |
---|
253 | |
---|
254 | |
---|
255 | |
---|
256 | registerType(ClassificacaoOrcamentaria,PROJECTNAME) |
---|
257 | # end of class ClassificacaoOrcamentaria |
---|
258 | |
---|
259 | ##code-section module-footer #fill in your manual code here |
---|
260 | ##/code-section module-footer |
---|
261 | |
---|
262 | |
---|
263 | |
---|