source: publico/ILSAALMaterial/trunk/Inventario.py @ 781

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

Implementados mtodos _titulo() das classes e fechado ticket #57.

File size: 5.5 KB
Linha 
1# File: Inventario.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 <admin-stc@interlegis.gov.br>'''
22__docformat__ = 'plaintext'
23
24
25from AccessControl import ClassSecurityInfo
26from Products.Archetypes.atapi import *
27from Products.ILSAALMaterial.interfaces.IInventario import IInventario
28
29
30from Products.Archetypes.SQLStorage import *
31# additional imports from tagged value 'import'
32from DateTime import DateTime
33from Products.ILSAAL.saalapi import *
34
35from Products.ILSAALMaterial.config import *
36##code-section module-header #fill in your manual code here
37##/code-section module-header
38
39schema=Schema((
40    DateTimeField('dat_referencia',
41        widget=CalendarWidget(
42            label="Referencia",
43            description="Data a qual o inventario se refere.",
44            format="%d/%m/%Y",
45            date_only=1,
46            label_msgid='ILSAALMaterial_label_dat_referencia',
47            description_msgid='ILSAALMaterial_help_dat_referencia',
48            i18n_domain='ILSAALMaterial',
49        ),
50        required=1
51    ),
52
53    StringField('cod_classe',
54        widget=StringWidget(
55            label="Classe",
56            description="Codigo da classe do item do inventario.",
57            label_msgid='ILSAALMaterial_label_cod_classe',
58            description_msgid='ILSAALMaterial_help_cod_classe',
59            i18n_domain='ILSAALMaterial',
60        ),
61        required=1
62    ),
63
64    IntegerField('qtd_item_material',
65        widget=IntegerWidget(
66            label="Item",
67            description="Quantidade do item do inventario.",
68            label_msgid='ILSAALMaterial_label_qtd_item_material',
69            description_msgid='ILSAALMaterial_help_qtd_item_material',
70            i18n_domain='ILSAALMaterial',
71        ),
72        required=1
73    ),
74
75    FloatField('vlr_unitario_item_material',
76        widget=DecimalWidget(
77            label="Valor Unitario",
78            description="Valor unitario do item do inventario.",
79            label_msgid='ILSAALMaterial_label_vlr_unitario_item_material',
80            description_msgid='ILSAALMaterial_help_vlr_unitario_item_material',
81            i18n_domain='ILSAALMaterial',
82        ),
83        required=1
84    ),
85
86    DateTimeField('dat_geracao_inventario',
87        widget=CalendarWidget(
88            label="Geracao",
89            description="Data da geracao do inventario.",
90            format="%d/%m/%Y",
91            date_only=1,
92            visible={'edit':'hidden','view':'visible'},
93            label_msgid='ILSAALMaterial_label_dat_geracao_inventario',
94            description_msgid='ILSAALMaterial_help_dat_geracao_inventario',
95            i18n_domain='ILSAALMaterial',
96        ),
97        required=1
98    ),
99
100
101    ReferenceField('cod_item_material',
102        widget=ReferenceWidget(
103            label='Cod_item_material',
104            label_msgid='ILSAALMaterial_label_cod_item_material',
105            description_msgid='ILSAALMaterial_help_cod_item_material',
106            i18n_domain='ILSAALMaterial',
107        ),
108        allowed_types=('Material',),
109        multiValued=0,
110        relationship='Inventario_Material'
111    ),
112
113),
114)
115
116
117##code-section after-local-schema #fill in your manual code here
118##/code-section after-local-schema
119
120Inventario_schema = BaseSchema + \
121    schema
122
123##code-section after-schema #fill in your manual code here
124##/code-section after-schema
125
126class Inventario(BaseContent):
127    """
128    Representa um inventario mensal de materiais.
129    """
130    security = ClassSecurityInfo()
131    __implements__ = (getattr(BaseContent,'__implements__',()),) + (IInventario,)
132
133
134    # This name appears in the 'add' box
135    archetype_name             = 'Inventario'
136
137    meta_type                  = 'Inventario'
138    portal_type                = 'Inventario'
139    allowed_content_types      = []
140    filter_content_types       = 0
141    global_allow               = 0
142    allow_discussion           = 0
143    #content_icon               = 'Inventario.gif'
144    immediate_view             = 'base_view'
145    default_view               = 'base_view'
146    suppl_views                = ()
147    typeDescription            = "Inventario"
148    typeDescMsgId              = 'description_edit_inventario'
149
150    schema = Inventario_schema
151
152    ##code-section class-header #fill in your manual code here
153    ##/code-section class-header
154
155
156    #Methods
157    #methods from Interface IInventario
158
159    security.declarePrivate('_titulo')
160    def _titulo(self):
161        """
162        Configuracao do titulo que esse objeto deseja disponibilizar.
163        """
164       
165        return str(self.getDat_referencia()) + ': ' + sel.getCod_classe()
166
167
168
169registerType(Inventario,PROJECTNAME)
170# end of class Inventario
171
172##code-section module-footer #fill in your manual code here
173##/code-section module-footer
174
175
176
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.