source: publico/ILSAALMaterial/trunk/Requisicoes.py @ 1523

Última Alteração nesse arquivo desde 1523 foi 1523, incluída por jeanferri, 14 anos atrás

Atualizada a versão do ArchGenXml para a 1.4RC2

File size: 4.5 KB
Linha 
1# File: Requisicoes.py
2#
3# Copyright (c) 2005 by Interlegis
4# Generator: ArchGenXML Version 1.4.0-RC2 svn/development
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
25from AccessControl import ClassSecurityInfo
26from Products.Archetypes.atapi import *
27from Products.CMFCore.utils import UniqueObject
28
29
30from Products.Archetypes.SQLStorage import *
31# additional imports from tagged value 'import'
32from Products.ILSAAL.saalapi import *
33
34from Products.ILSAALMaterial.config import *
35##code-section module-header #fill in your manual code here
36##/code-section module-header
37
38schema=Schema((
39    IntegerField('id_sequencial',
40        widget=IntegerWidget(
41            visible={'edit':'hidden','view':'hidden'},
42            label="Id Sequencial",
43            description="Variavel oculta para a geracao do id sequencial",
44            label_msgid='ILSAALMaterial_label_id_sequencial',
45            description_msgid='ILSAALMaterial_help_id_sequencial',
46            i18n_domain='ILSAALMaterial',
47        )
48    ),
49
50    IntegerField('id_ano',
51        widget=IntegerWidget(
52            visible={'edit':'hidden','view':'hidden'},
53            label="Id Ano",
54            description="Variavel oculta do ano para a criacao do id sequencial",
55            label_msgid='ILSAALMaterial_label_id_ano',
56            description_msgid='ILSAALMaterial_help_id_ano',
57            i18n_domain='ILSAALMaterial',
58        )
59    ),
60
61),
62)
63
64
65##code-section after-local-schema #fill in your manual code here
66##/code-section after-local-schema
67
68Requisicoes_schema = BaseBTreeFolderSchema + \
69    getattr(UniqueObject,'schema',Schema(())) + \
70    schema
71
72##code-section after-schema #fill in your manual code here
73##/code-section after-schema
74
75class Requisicoes(UniqueObject,BaseBTreeFolder):
76    """
77    Container de Requisicoes.
78    """
79    security = ClassSecurityInfo()
80    __implements__ = (getattr(UniqueObject,'__implements__',()),) + (getattr(BaseBTreeFolder,'__implements__',()),)
81
82
83    # This name appears in the 'add' box
84    archetype_name             = 'Requisicoes'
85
86    meta_type                  = 'Requisicoes'
87    portal_type                = 'Requisicoes'
88    allowed_content_types      = ['Requisicao'] + list(getattr(UniqueObject, 'allowed_content_types', []))
89    filter_content_types       = 1
90    global_allow               = 0
91    allow_discussion           = 0
92    #content_icon               = 'Requisicoes.gif'
93    immediate_view             = 'base_view'
94    default_view               = 'base_view'
95    suppl_views                = ()
96    typeDescription            = "Requisicoes"
97    typeDescMsgId              = 'description_edit_requisicoes'
98
99    schema = Requisicoes_schema
100
101    ##code-section class-header #fill in your manual code here
102    ##/code-section class-header
103
104
105    #Methods
106
107    # Use class/module security defaults
108    def __init__(self,id=None):
109        """
110        Construtor da classe. Fixa o id para nao ser mais alterado.
111        """
112       
113        BaseBTreeFolder.__init__(self, 'requisicoes')
114
115
116
117    security.declarePrivate('geraIdRequisicao')
118    def geraIdRequisicao(self):
119        """
120        Gera o identificador sequencial da requisicao, retornando-o
121        """
122       
123        ano_id = self.getId_ano()
124        sequencial_id = self.getId_sequencial()
125        este_ano = int(DateTime().year())
126        if ano_id == este_ano:
127            novo_sequencial = sequencial_id + 1
128            self.setId_sequencial(novo_sequencial)
129        else:
130            self.setId_ano(este_ano)
131            novo_sequencial = 1
132            self.setId_sequencial(novo_sequencial)
133       
134        return str(este_ano) + '/' + '%07d' %(novo_sequencial)
135
136
137
138registerType(Requisicoes,PROJECTNAME)
139# end of class Requisicoes
140
141##code-section module-footer #fill in your manual code here
142##/code-section module-footer
143
144
145
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.