source: main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/contracts.py @ 17421

Last change on this file since 17421 was 12803, checked in by Henrik Bettermann, 10 years ago

Prepare products and contracts for annual payments.

  • Property svn:keywords set to Id
File size: 10.4 KB
RevLine 
[12286]1## $Id: contracts.py 12803 2015-03-20 18:51:29Z henrik $
[12273]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"""
19Customer contract components.
20"""
21
22import grok
23from zope.component.interfaces import IFactory
24from zope.interface import implementedBy
25from waeup.ikoba.utils.helpers import attrs_to_fields
26from waeup.ikoba.customers.interfaces import ICustomerNavigation
27from waeup.ikoba.customers.contracts import ContractBase
[12371]28from ikobacustom.pcn.interfaces import MessageFactory as _
29from ikobacustom.pcn.customers.interfaces import (
[12571]30    IRONContract,
31    IRONContractEdit,
32    IRONContractProcess,
33    IRONContractOfficialUse,
34    IROPContract,
35    IROPContractEdit,
36    IROPContractProcess,
37    IROPContractOfficialUse,
38    IRPRContract,
39    IRPRContractEdit,
40    IRPRContractProcess,
41    IRPRContractOfficialUse,
[12591]42    IRPCContract,
43    IRPCContractEdit,
44    IRPCContractProcess,
45    IRPCContractOfficialUse,
[12601]46    IIPPMVLContract,
47    IIPPMVLContractEdit,
48    IIPPMVLContractProcess,
49    IIPPMVLContractOfficialUse,
[12604]50    IRPPMVLContract,
51    IRPPMVLContractEdit,
52    IRPPMVLContractProcess,
53    IRPPMVLContractOfficialUse,
[12611]54    IAPPITContract,
55    IAPPITContractEdit,
56    IAPPITContractProcess,
57    IAPPITContractOfficialUse,
[12615]58    IRPTContract,
59    IRPTContractEdit,
60    IRPTContractProcess,
61    IRPTContractOfficialUse,
[12617]62    IAPPTContract,
63    IAPPTContractEdit,
64    IAPPTContractProcess,
65    IAPPTContractOfficialUse,
[12571]66    )
[12273]67
68
[12803]69class PCNContract(ContractBase):
[12273]70    """This is a sample contract.
71    """
72
[12803]73    def __init__(self):
74        super(PCNContract, self).__init__()
75        # The site doesn't exist in unit tests
76        self.contract_year = None
77        return
78
79
80class RONContract(PCNContract):
81    """This is a sample contract.
82    """
83
[12273]84    grok.implements(
[12484]85        IRONContractProcess,
86        IRONContract,
87        IRONContractEdit,
[12335]88        ICustomerNavigation)
[12273]89
[12488]90    contract_category = 'ron'
[12273]91
[12484]92    form_fields_interface = IRONContract
[12273]93
[12484]94    edit_form_fields_interface = IRONContractEdit
[12273]95
[12501]96    ou_form_fields_interface = IRONContractOfficialUse
97
[12484]98    check_docs_interface = IRONContract
[12273]99
[12484]100RONContract = attrs_to_fields(RONContract)
[12273]101
102
[12484]103class RONContractFactory(grok.GlobalUtility):
[12273]104    """A factory for contracts.
105    """
106    grok.implements(IFactory)
[12484]107    grok.name(u'waeup.RONContract')
[12401]108    title = u"Create a new license contract.",
[12499]109    description = u"This factory instantiates new contract instances."
[12273]110
111    def __call__(self, *args, **kw):
[12484]112        return RONContract(*args, **kw)
[12273]113
114    def getInterfaces(self):
[12484]115        return implementedBy(RONContract)
[12499]116
117
[12803]118class ROPContract(PCNContract):
[12499]119    """This is a sample contract.
120    """
121
122    grok.implements(
123        IROPContractProcess,
124        IROPContract,
125        IROPContractEdit,
126        ICustomerNavigation)
127
128    contract_category = 'rop'
129
130    form_fields_interface = IROPContract
131
132    edit_form_fields_interface = IROPContractEdit
133
[12501]134    ou_form_fields_interface = IROPContractOfficialUse
135
[12499]136    check_docs_interface = IROPContract
137
138ROPContract = attrs_to_fields(ROPContract)
139
140
141class ROPContractFactory(grok.GlobalUtility):
142    """A factory for contracts.
143    """
144    grok.implements(IFactory)
145    grok.name(u'waeup.ROPContract')
146    title = u"Create a new license contract.",
147    description = u"This factory instantiates new contract instances."
148
149    def __call__(self, *args, **kw):
150        return ROPContract(*args, **kw)
151
152    def getInterfaces(self):
153        return implementedBy(ROPContract)
[12571]154
155
[12803]156class RPRContract(PCNContract):
[12571]157    """Registration in the Provisional Register contract.
158    """
159
160    grok.implements(
161        IRPRContractProcess,
162        IRPRContract,
163        IRPRContractEdit,
164        ICustomerNavigation)
165
166    contract_category = 'rpr'
167
168    form_fields_interface = IRPRContract
169
170    edit_form_fields_interface = IRPRContractEdit
171
172    ou_form_fields_interface = IRPRContractOfficialUse
173
174    check_docs_interface = IRPRContract
175
176RPRContract = attrs_to_fields(RPRContract)
177
178
179class RPRContractFactory(grok.GlobalUtility):
180    """A factory for contracts.
181    """
182    grok.implements(IFactory)
183    grok.name(u'waeup.RPRContract')
184    title = u"Create a new license contract.",
185    description = u"This factory instantiates new contract instances."
186
187    def __call__(self, *args, **kw):
188        return RPRContract(*args, **kw)
189
190    def getInterfaces(self):
191        return implementedBy(RPRContract)
[12591]192
193
[12803]194class RPCContract(PCNContract):
[12591]195    """Registration as Pharmaceutical Chemist contract.
196    """
197
198    grok.implements(
199        IRPCContractProcess,
200        IRPCContract,
201        IRPCContractEdit,
202        ICustomerNavigation)
203
204    contract_category = 'rpc'
205
206    form_fields_interface = IRPCContract
207
208    edit_form_fields_interface = IRPCContractEdit
209
210    ou_form_fields_interface = IRPCContractOfficialUse
211
212    check_docs_interface = IRPCContract
213
214RPCContract = attrs_to_fields(RPCContract)
215
216
217class RPCContractFactory(grok.GlobalUtility):
218    """A factory for contracts.
219    """
220    grok.implements(IFactory)
221    grok.name(u'waeup.RPCContract')
222    title = u"Create a new license contract.",
223    description = u"This factory instantiates new contract instances."
224
225    def __call__(self, *args, **kw):
226        return RPCContract(*args, **kw)
227
228    def getInterfaces(self):
229        return implementedBy(RPCContract)
230
[12601]231
[12803]232class IPPMVLContract(PCNContract):
[12601]233    """Issuance of Patent and Proprietary Medicines Vendors License contract.
234    """
235
236    grok.implements(
237        IIPPMVLContractProcess,
238        IIPPMVLContract,
239        IIPPMVLContractEdit,
240        ICustomerNavigation)
241
242    contract_category = 'ippmvl'
243
244    form_fields_interface = IIPPMVLContract
245
246    edit_form_fields_interface = IIPPMVLContractEdit
247
248    ou_form_fields_interface = IIPPMVLContractOfficialUse
249
250    check_docs_interface = IIPPMVLContract
251
252IPPMVLContract = attrs_to_fields(IPPMVLContract)
253
254
255class IPPMVLContractFactory(grok.GlobalUtility):
256    """A factory for contracts.
257    """
258    grok.implements(IFactory)
259    grok.name(u'waeup.IPPMVLContract')
260    title = u"Create a new license contract.",
261    description = u"This factory instantiates new contract instances."
262
263    def __call__(self, *args, **kw):
264        return IPPMVLContract(*args, **kw)
265
266    def getInterfaces(self):
267        return implementedBy(IPPMVLContract)
268
[12611]269
[12803]270class RPPMVLContract(PCNContract):
[12604]271    """Renewal of Patent and Proprietary Medicines Vendors License contract.
272    """
273
274    grok.implements(
275        IRPPMVLContractProcess,
276        IRPPMVLContract,
277        IRPPMVLContractEdit,
278        ICustomerNavigation)
279
280    contract_category = 'rppmvl'
281
282    form_fields_interface = IRPPMVLContract
283
284    edit_form_fields_interface = IRPPMVLContractEdit
285
286    ou_form_fields_interface = IRPPMVLContractOfficialUse
287
288    check_docs_interface = IRPPMVLContract
289
290RPPMVLContract = attrs_to_fields(RPPMVLContract)
291
292
293class RPPMVLContractFactory(grok.GlobalUtility):
294    """A factory for contracts.
295    """
296    grok.implements(IFactory)
297    grok.name(u'waeup.RPPMVLContract')
298    title = u"Create a new license contract.",
299    description = u"This factory instantiates new contract instances."
300
301    def __call__(self, *args, **kw):
302        return RPPMVLContract(*args, **kw)
303
304    def getInterfaces(self):
305        return implementedBy(RPPMVLContract)
306
[12611]307
[12803]308class APPITContract(PCNContract):
[12611]309    """Accepting Pupil Pharmacist for Internship Training contract.
310    """
311
312    grok.implements(
313        IAPPITContractProcess,
314        IAPPITContract,
315        IAPPITContractEdit,
316        ICustomerNavigation)
317
318    contract_category = 'appit'
319
320    form_fields_interface = IAPPITContract
321
322    edit_form_fields_interface = IAPPITContractEdit
323
324    ou_form_fields_interface = IAPPITContractOfficialUse
325
326    check_docs_interface = IAPPITContract
327
328APPITContract = attrs_to_fields(APPITContract)
329
330
331class APPITContractFactory(grok.GlobalUtility):
332    """A factory for contracts.
333    """
334    grok.implements(IFactory)
335    grok.name(u'waeup.APPITContract')
336    title = u"Create a new license contract.",
337    description = u"This factory instantiates new contract instances."
338
339    def __call__(self, *args, **kw):
340        return APPITContract(*args, **kw)
341
342    def getInterfaces(self):
343        return implementedBy(APPITContract)
344
[12615]345
[12803]346class RPTContract(PCNContract):
[12615]347    """Registration as a Pharmacy Technician contract.
348    """
349
350    grok.implements(
351        IRPTContractProcess,
352        IRPTContract,
353        IRPTContractEdit,
354        ICustomerNavigation)
355
356    contract_category = 'rpt'
357
358    form_fields_interface = IRPTContract
359
360    edit_form_fields_interface = IRPTContractEdit
361
362    ou_form_fields_interface = IRPTContractOfficialUse
363
364    check_docs_interface = IRPTContract
365
366RPTContract = attrs_to_fields(RPTContract)
367
368
369class RPTContractFactory(grok.GlobalUtility):
370    """A factory for contracts.
371    """
372    grok.implements(IFactory)
373    grok.name(u'waeup.RPTContract')
374    title = u"Create a new license contract.",
375    description = u"This factory instantiates new contract instances."
376
377    def __call__(self, *args, **kw):
378        return RPTContract(*args, **kw)
379
380    def getInterfaces(self):
381        return implementedBy(RPTContract)
382
[12617]383
[12803]384class APPTContract(PCNContract):
[12617]385    """Annual Permit for Pharmacy Technician contract.
386    """
387
388    grok.implements(
389        IAPPTContractProcess,
390        IAPPTContract,
391        IAPPTContractEdit,
392        ICustomerNavigation)
393
394    contract_category = 'appt'
395
396    form_fields_interface = IAPPTContract
397
398    edit_form_fields_interface = IAPPTContractEdit
399
400    ou_form_fields_interface = IAPPTContractOfficialUse
401
402    check_docs_interface = IAPPTContract
403
404APPTContract = attrs_to_fields(APPTContract)
405
406
407class APPTContractFactory(grok.GlobalUtility):
408    """A factory for contracts.
409    """
410    grok.implements(IFactory)
411    grok.name(u'waeup.APPTContract')
412    title = u"Create a new license contract.",
413    description = u"This factory instantiates new contract instances."
414
415    def __call__(self, *args, **kw):
416        return APPTContract(*args, **kw)
417
418    def getInterfaces(self):
419        return implementedBy(APPTContract)
420
Note: See TracBrowser for help on using the repository browser.