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

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

novo codigo gerado

File size: 4.1 KB
Linha 
1# File: Requisicoes.py
2#
3# Copyright (c) 2005 by Interlegis
4# Generator: ArchGenXML Version 1.4.0-RC1 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
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    DateTimeField('id_ano',
40        default=2005,
41        date_only=1,
42        widget=CalendarWidget(
43            visible={'edit':'hidden','view':'hidden'},
44            label="Id Ano",
45            description="Variavel oculta do ano para a criacao do id sequencial",
46            format="%Y",
47            label_msgid='ILSAALMaterial_label_id_ano',
48            description_msgid='ILSAALMaterial_help_id_ano',
49            i18n_domain='ILSAALMaterial',
50        )
51    ),
52
53),
54)
55
56
57##code-section after-local-schema #fill in your manual code here
58##/code-section after-local-schema
59
60Requisicoes_schema = BaseBTreeFolderSchema + \
61    getattr(UniqueObject,'schema',Schema(())) + \
62    schema
63
64##code-section after-schema #fill in your manual code here
65##/code-section after-schema
66
67class Requisicoes(UniqueObject,BaseBTreeFolder):
68    """
69    Container de Requisicoes.
70    """
71    security = ClassSecurityInfo()
72    __implements__ = (getattr(UniqueObject,'__implements__',()),) + (getattr(BaseBTreeFolder,'__implements__',()),)
73
74
75    # This name appears in the 'add' box
76    archetype_name             = 'Requisicoes'
77
78    meta_type                  = 'Requisicoes'
79    portal_type                = 'Requisicoes'
80    allowed_content_types      = ['Requisicao'] + list(getattr(UniqueObject, 'allowed_content_types', []))
81    filter_content_types       = 1
82    global_allow               = 0
83    allow_discussion           = 0
84    #content_icon               = 'Requisicoes.gif'
85    immediate_view             = 'base_view'
86    default_view               = 'base_view'
87    suppl_views                = ()
88    typeDescription            = "Requisicoes"
89    typeDescMsgId              = 'description_edit_requisicoes'
90
91    schema = Requisicoes_schema
92
93    ##code-section class-header #fill in your manual code here
94    ##/code-section class-header
95
96
97    #Methods
98
99    # Use class/module security defaults
100    def __init__(self,id=None):
101        """
102        Construtor da classe. Fixa o id para nao ser mais alterado.
103        """
104       
105        BaseBTreeFolder.__init__(self, 'requisicoes')
106
107
108    #manually created methods
109
110    def geraIdRequisicao(self):
111        """
112        Gera o identificador sequencial da requisicao, retornando-o
113        """
114       
115        ano_id = self.getId_ano()
116        sequencial_id = self.getId_sequencial()
117        este_ano = int(DateTime().year())
118        if ano_id == este_ano:
119            novo_sequencial = sequencial_id + 1
120            self.setId_sequencial(novo_sequencial)
121        else:
122            self.setId_ano(este_ano)
123            novo_sequencial = 1
124            self.setId_sequencial(novo_sequencial)
125       
126        return str(este_ano) + '/' + '%07d' %(novo_sequencial)
127
128
129
130registerType(Requisicoes,PROJECTNAME)
131# end of class Requisicoes
132
133##code-section module-footer #fill in your manual code here
134##/code-section module-footer
135
136
137
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.