1 | ## $Id: contracts.py 12591 2015-02-11 10:44:28Z 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 | IRPCContract, |
---|
43 | IRPCContractEdit, |
---|
44 | IRPCContractProcess, |
---|
45 | IRPCContractOfficialUse, |
---|
46 | ) |
---|
47 | |
---|
48 | |
---|
49 | class RONContract(ContractBase): |
---|
50 | """This is a sample contract. |
---|
51 | """ |
---|
52 | |
---|
53 | grok.implements( |
---|
54 | IRONContractProcess, |
---|
55 | IRONContract, |
---|
56 | IRONContractEdit, |
---|
57 | ICustomerNavigation) |
---|
58 | |
---|
59 | contract_category = 'ron' |
---|
60 | |
---|
61 | form_fields_interface = IRONContract |
---|
62 | |
---|
63 | edit_form_fields_interface = IRONContractEdit |
---|
64 | |
---|
65 | ou_form_fields_interface = IRONContractOfficialUse |
---|
66 | |
---|
67 | check_docs_interface = IRONContract |
---|
68 | |
---|
69 | RONContract = attrs_to_fields(RONContract) |
---|
70 | |
---|
71 | |
---|
72 | class RONContractFactory(grok.GlobalUtility): |
---|
73 | """A factory for contracts. |
---|
74 | """ |
---|
75 | grok.implements(IFactory) |
---|
76 | grok.name(u'waeup.RONContract') |
---|
77 | title = u"Create a new license contract.", |
---|
78 | description = u"This factory instantiates new contract instances." |
---|
79 | |
---|
80 | def __call__(self, *args, **kw): |
---|
81 | return RONContract(*args, **kw) |
---|
82 | |
---|
83 | def getInterfaces(self): |
---|
84 | return implementedBy(RONContract) |
---|
85 | |
---|
86 | |
---|
87 | class ROPContract(ContractBase): |
---|
88 | """This is a sample contract. |
---|
89 | """ |
---|
90 | |
---|
91 | grok.implements( |
---|
92 | IROPContractProcess, |
---|
93 | IROPContract, |
---|
94 | IROPContractEdit, |
---|
95 | ICustomerNavigation) |
---|
96 | |
---|
97 | contract_category = 'rop' |
---|
98 | |
---|
99 | form_fields_interface = IROPContract |
---|
100 | |
---|
101 | edit_form_fields_interface = IROPContractEdit |
---|
102 | |
---|
103 | ou_form_fields_interface = IROPContractOfficialUse |
---|
104 | |
---|
105 | check_docs_interface = IROPContract |
---|
106 | |
---|
107 | ROPContract = attrs_to_fields(ROPContract) |
---|
108 | |
---|
109 | |
---|
110 | class ROPContractFactory(grok.GlobalUtility): |
---|
111 | """A factory for contracts. |
---|
112 | """ |
---|
113 | grok.implements(IFactory) |
---|
114 | grok.name(u'waeup.ROPContract') |
---|
115 | title = u"Create a new license contract.", |
---|
116 | description = u"This factory instantiates new contract instances." |
---|
117 | |
---|
118 | def __call__(self, *args, **kw): |
---|
119 | return ROPContract(*args, **kw) |
---|
120 | |
---|
121 | def getInterfaces(self): |
---|
122 | return implementedBy(ROPContract) |
---|
123 | |
---|
124 | |
---|
125 | class RPRContract(ContractBase): |
---|
126 | """Registration in the Provisional Register contract. |
---|
127 | """ |
---|
128 | |
---|
129 | grok.implements( |
---|
130 | IRPRContractProcess, |
---|
131 | IRPRContract, |
---|
132 | IRPRContractEdit, |
---|
133 | ICustomerNavigation) |
---|
134 | |
---|
135 | contract_category = 'rpr' |
---|
136 | |
---|
137 | form_fields_interface = IRPRContract |
---|
138 | |
---|
139 | edit_form_fields_interface = IRPRContractEdit |
---|
140 | |
---|
141 | ou_form_fields_interface = IRPRContractOfficialUse |
---|
142 | |
---|
143 | check_docs_interface = IRPRContract |
---|
144 | |
---|
145 | RPRContract = attrs_to_fields(RPRContract) |
---|
146 | |
---|
147 | |
---|
148 | class RPRContractFactory(grok.GlobalUtility): |
---|
149 | """A factory for contracts. |
---|
150 | """ |
---|
151 | grok.implements(IFactory) |
---|
152 | grok.name(u'waeup.RPRContract') |
---|
153 | title = u"Create a new license contract.", |
---|
154 | description = u"This factory instantiates new contract instances." |
---|
155 | |
---|
156 | def __call__(self, *args, **kw): |
---|
157 | return RPRContract(*args, **kw) |
---|
158 | |
---|
159 | def getInterfaces(self): |
---|
160 | return implementedBy(RPRContract) |
---|
161 | |
---|
162 | |
---|
163 | class RPCContract(ContractBase): |
---|
164 | """Registration as Pharmaceutical Chemist contract. |
---|
165 | """ |
---|
166 | |
---|
167 | grok.implements( |
---|
168 | IRPCContractProcess, |
---|
169 | IRPCContract, |
---|
170 | IRPCContractEdit, |
---|
171 | ICustomerNavigation) |
---|
172 | |
---|
173 | contract_category = 'rpc' |
---|
174 | |
---|
175 | form_fields_interface = IRPCContract |
---|
176 | |
---|
177 | edit_form_fields_interface = IRPCContractEdit |
---|
178 | |
---|
179 | ou_form_fields_interface = IRPCContractOfficialUse |
---|
180 | |
---|
181 | check_docs_interface = IRPCContract |
---|
182 | |
---|
183 | RPCContract = attrs_to_fields(RPCContract) |
---|
184 | |
---|
185 | |
---|
186 | class RPCContractFactory(grok.GlobalUtility): |
---|
187 | """A factory for contracts. |
---|
188 | """ |
---|
189 | grok.implements(IFactory) |
---|
190 | grok.name(u'waeup.RPCContract') |
---|
191 | title = u"Create a new license contract.", |
---|
192 | description = u"This factory instantiates new contract instances." |
---|
193 | |
---|
194 | def __call__(self, *args, **kw): |
---|
195 | return RPCContract(*args, **kw) |
---|
196 | |
---|
197 | def getInterfaces(self): |
---|
198 | return implementedBy(RPCContract) |
---|
199 | |
---|