[12286] | 1 | ## $Id: contracts.py 12571 2015-02-09 08:30:13Z 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 | """ |
---|
| 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 |
---|
[12371] | 28 | from ikobacustom.pcn.interfaces import MessageFactory as _ |
---|
| 29 | from 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, |
---|
| 42 | ) |
---|
[12273] | 43 | |
---|
| 44 | |
---|
[12484] | 45 | class RONContract(ContractBase): |
---|
[12273] | 46 | """This is a sample contract. |
---|
| 47 | """ |
---|
| 48 | |
---|
| 49 | grok.implements( |
---|
[12484] | 50 | IRONContractProcess, |
---|
| 51 | IRONContract, |
---|
| 52 | IRONContractEdit, |
---|
[12335] | 53 | ICustomerNavigation) |
---|
[12273] | 54 | |
---|
[12488] | 55 | contract_category = 'ron' |
---|
[12273] | 56 | |
---|
[12484] | 57 | form_fields_interface = IRONContract |
---|
[12273] | 58 | |
---|
[12484] | 59 | edit_form_fields_interface = IRONContractEdit |
---|
[12273] | 60 | |
---|
[12501] | 61 | ou_form_fields_interface = IRONContractOfficialUse |
---|
| 62 | |
---|
[12484] | 63 | check_docs_interface = IRONContract |
---|
[12273] | 64 | |
---|
[12484] | 65 | RONContract = attrs_to_fields(RONContract) |
---|
[12273] | 66 | |
---|
| 67 | |
---|
[12484] | 68 | class RONContractFactory(grok.GlobalUtility): |
---|
[12273] | 69 | """A factory for contracts. |
---|
| 70 | """ |
---|
| 71 | grok.implements(IFactory) |
---|
[12484] | 72 | grok.name(u'waeup.RONContract') |
---|
[12401] | 73 | title = u"Create a new license contract.", |
---|
[12499] | 74 | description = u"This factory instantiates new contract instances." |
---|
[12273] | 75 | |
---|
| 76 | def __call__(self, *args, **kw): |
---|
[12484] | 77 | return RONContract(*args, **kw) |
---|
[12273] | 78 | |
---|
| 79 | def getInterfaces(self): |
---|
[12484] | 80 | return implementedBy(RONContract) |
---|
[12499] | 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 | |
---|
[12501] | 99 | ou_form_fields_interface = IROPContractOfficialUse |
---|
| 100 | |
---|
[12499] | 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) |
---|
[12571] | 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) |
---|