1 | ## $Id: contracts.py 12571 2015-02-09 08:30:13Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | """ |
---|
19 | Customer contract components. |
---|
20 | """ |
---|
21 | |
---|
22 | import grok |
---|
23 | from zope.component.interfaces import IFactory |
---|
24 | from zope.interface import implementedBy |
---|
25 | from waeup.ikoba.utils.helpers import attrs_to_fields |
---|
26 | from waeup.ikoba.customers.interfaces import ICustomerNavigation |
---|
27 | from waeup.ikoba.customers.contracts import ContractBase |
---|
28 | from ikobacustom.pcn.interfaces import MessageFactory as _ |
---|
29 | from ikobacustom.pcn.customers.interfaces import ( |
---|
30 | IRONContract, |
---|
31 | IRONContractEdit, |
---|
32 | IRONContractProcess, |
---|
33 | IRONContractOfficialUse, |
---|
34 | IROPContract, |
---|
35 | IROPContractEdit, |
---|
36 | IROPContractProcess, |
---|
37 | IROPContractOfficialUse, |
---|
38 | IRPRContract, |
---|
39 | IRPRContractEdit, |
---|
40 | IRPRContractProcess, |
---|
41 | IRPRContractOfficialUse, |
---|
42 | ) |
---|
43 | |
---|
44 | |
---|
45 | class RONContract(ContractBase): |
---|
46 | """This is a sample contract. |
---|
47 | """ |
---|
48 | |
---|
49 | grok.implements( |
---|
50 | IRONContractProcess, |
---|
51 | IRONContract, |
---|
52 | IRONContractEdit, |
---|
53 | ICustomerNavigation) |
---|
54 | |
---|
55 | contract_category = 'ron' |
---|
56 | |
---|
57 | form_fields_interface = IRONContract |
---|
58 | |
---|
59 | edit_form_fields_interface = IRONContractEdit |
---|
60 | |
---|
61 | ou_form_fields_interface = IRONContractOfficialUse |
---|
62 | |
---|
63 | check_docs_interface = IRONContract |
---|
64 | |
---|
65 | RONContract = attrs_to_fields(RONContract) |
---|
66 | |
---|
67 | |
---|
68 | class RONContractFactory(grok.GlobalUtility): |
---|
69 | """A factory for contracts. |
---|
70 | """ |
---|
71 | grok.implements(IFactory) |
---|
72 | grok.name(u'waeup.RONContract') |
---|
73 | title = u"Create a new license contract.", |
---|
74 | description = u"This factory instantiates new contract instances." |
---|
75 | |
---|
76 | def __call__(self, *args, **kw): |
---|
77 | return RONContract(*args, **kw) |
---|
78 | |
---|
79 | def getInterfaces(self): |
---|
80 | return implementedBy(RONContract) |
---|
81 | |
---|
82 | |
---|
83 | class ROPContract(ContractBase): |
---|
84 | """This is a sample contract. |
---|
85 | """ |
---|
86 | |
---|
87 | grok.implements( |
---|
88 | IROPContractProcess, |
---|
89 | IROPContract, |
---|
90 | IROPContractEdit, |
---|
91 | ICustomerNavigation) |
---|
92 | |
---|
93 | contract_category = 'rop' |
---|
94 | |
---|
95 | form_fields_interface = IROPContract |
---|
96 | |
---|
97 | edit_form_fields_interface = IROPContractEdit |
---|
98 | |
---|
99 | ou_form_fields_interface = IROPContractOfficialUse |
---|
100 | |
---|
101 | check_docs_interface = IROPContract |
---|
102 | |
---|
103 | ROPContract = attrs_to_fields(ROPContract) |
---|
104 | |
---|
105 | |
---|
106 | class ROPContractFactory(grok.GlobalUtility): |
---|
107 | """A factory for contracts. |
---|
108 | """ |
---|
109 | grok.implements(IFactory) |
---|
110 | grok.name(u'waeup.ROPContract') |
---|
111 | title = u"Create a new license contract.", |
---|
112 | description = u"This factory instantiates new contract instances." |
---|
113 | |
---|
114 | def __call__(self, *args, **kw): |
---|
115 | return ROPContract(*args, **kw) |
---|
116 | |
---|
117 | def getInterfaces(self): |
---|
118 | return implementedBy(ROPContract) |
---|
119 | |
---|
120 | |
---|
121 | class RPRContract(ContractBase): |
---|
122 | """Registration in the Provisional Register contract. |
---|
123 | """ |
---|
124 | |
---|
125 | grok.implements( |
---|
126 | IRPRContractProcess, |
---|
127 | IRPRContract, |
---|
128 | IRPRContractEdit, |
---|
129 | ICustomerNavigation) |
---|
130 | |
---|
131 | contract_category = 'rpr' |
---|
132 | |
---|
133 | form_fields_interface = IRPRContract |
---|
134 | |
---|
135 | edit_form_fields_interface = IRPRContractEdit |
---|
136 | |
---|
137 | ou_form_fields_interface = IRPRContractOfficialUse |
---|
138 | |
---|
139 | check_docs_interface = IRPRContract |
---|
140 | |
---|
141 | RPRContract = attrs_to_fields(RPRContract) |
---|
142 | |
---|
143 | |
---|
144 | class RPRContractFactory(grok.GlobalUtility): |
---|
145 | """A factory for contracts. |
---|
146 | """ |
---|
147 | grok.implements(IFactory) |
---|
148 | grok.name(u'waeup.RPRContract') |
---|
149 | title = u"Create a new license contract.", |
---|
150 | description = u"This factory instantiates new contract instances." |
---|
151 | |
---|
152 | def __call__(self, *args, **kw): |
---|
153 | return RPRContract(*args, **kw) |
---|
154 | |
---|
155 | def getInterfaces(self): |
---|
156 | return implementedBy(RPRContract) |
---|