source: publico/ILSAALMaterial/trunk/__init__.py @ 1441

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

resolucao dos tickets #125 e #127

File size: 3.3 KB
Linha 
1#
2# Initialise the product's module. There are three ways to inject custom code
3# here:
4#
5#   - To set global configuration variables, create a file AppConfig.py. This
6#       will be imported in config.py, which in turn is imported in each
7#       generated class and in this file.
8#   - To perform custom initialisation after types have been registered, use
9#       the protected code section at the bottom of initialize().
10#   - To register a customisation policy, create a file CustomizationPolicy.py
11#       with a method register(context) to register the policy
12#
13
14from zLOG import LOG, INFO
15
16LOG('ILSAALMaterial',INFO, 'Installing Product')
17
18try:
19    import CustomizationPolicy
20except ImportError:
21    CustomizationPolicy=None
22
23from Globals import package_home
24from Products.CMFCore import utils as cmfutils
25from Products.CMFCore import CMFCorePermissions
26from Products.CMFCore import DirectoryView
27from Products.CMFPlone.PloneUtilities import ToolInit
28from Products.Archetypes.public import *
29from Products.Archetypes import listTypes
30from Products.Archetypes.utils import capitalize
31
32import os, os.path
33
34from Products.ILSAALMaterial.config import *
35
36DirectoryView.registerDirectory('skins', product_globals)
37DirectoryView.registerDirectory('skins/ILSAALMaterial',
38                                    product_globals)
39
40##code-section custom-init-head #fill in your manual code here
41##/code-section custom-init-head
42
43
44def initialize(context):
45    ##code-section custom-init-top #fill in your manual code here
46    ##/code-section custom-init-top
47
48    # imports packages and types for registration
49    import interfaces
50
51    import Material
52    import Fornecedor
53    import ItemRequisitado
54    import Requisicao
55    import Almoxarifado
56    import MovimentacaoEstoque
57    import ItemEntrada
58    import Entrada
59    import ContatoFornecedor
60    import LinhaAtendimento
61    import Inventario
62    import Estoque
63    import Requisicoes
64    import Almoxarifados
65    import Inventarios
66    import Entradas
67    import Fornecedores
68    import Fechamento
69    import Consolidacao
70    import Fechamentos
71    import GrupoMaterial
72    import GruposMaterial
73
74    # initialize portal content
75    all_content_types, all_constructors, all_ftis = process_types(
76        listTypes(PROJECTNAME),
77        PROJECTNAME)
78
79    cmfutils.ContentInit(
80        PROJECTNAME + ' Content',
81        content_types      = all_content_types,
82        permission         = DEFAULT_ADD_CONTENT_PERMISSION,
83        extra_constructors = all_constructors,
84        fti                = all_ftis,
85        ).initialize(context)
86
87    # give it some extra permissions to control them on a per class limit
88    for i in range(0,len(all_content_types)):
89        klassname=all_content_types[i].__name__
90        if not klassname in ADD_CONTENT_PERMISSIONS:
91            continue
92
93        context.registerClass(meta_type   = all_ftis[i]['meta_type'],
94                              constructors= (all_constructors[i],),
95                              permission  = ADD_CONTENT_PERMISSIONS[klassname])
96
97    # apply customization-policy, if theres any
98    if CustomizationPolicy and hasattr(CustomizationPolicy, 'register'):
99        CustomizationPolicy.register(context)
100        print 'Customization policy for ILSAALMaterial installed'
101
102    ##code-section custom-init-bottom #fill in your manual code here
103    ##/code-section custom-init-bottom
104
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.