Changeset 12803 for main/ikobacustom.pcn/trunk/src/ikobacustom/pcn
- Timestamp:
- 20 Mar 2015, 18:51:29 (10 years ago)
- Location:
- main/ikobacustom.pcn/trunk/src/ikobacustom/pcn
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/browser.py
r12617 r12803 20 20 from zope.component import getUtility 21 21 from waeup.ikoba.interfaces import IIkobaUtils, IExtFileStore 22 from waeup.ikoba.browser.layout import action 22 23 from waeup.ikoba.customers.browser import ( 23 PDFContractSlipPage, CustomerBaseEditFormPage )24 PDFContractSlipPage, CustomerBaseEditFormPage, ContractSelectProductPage, msave) 24 25 from ikobacustom.pcn.interfaces import MessageFactory as _ 25 26 from ikobacustom.pcn.customers.interfaces import ( … … 88 89 return error 89 90 return 91 92 93 class ContractSelectProductPage(ContractSelectProductPage): 94 """ Page to select a contract product 95 96 This page is for both customers and officers. 97 """ 98 99 @action(_('Save and proceed'), style='primary') 100 def save(self, **data): 101 msave(self, **data) 102 self.context.contract_year = self.context.product_object.contract_year 103 self.context.title = self.context.product_object.contract_autotitle 104 self.context.tc_dict = self.context.product_object.tc_dict 105 self.context.valid_from = self.context.product_object.valid_from 106 self.context.valid_to = self.context.product_object.valid_to 107 isCustomer = getattr( 108 self.request.principal, 'user_type', None) == 'customer' 109 if isCustomer: 110 self.redirect(self.url(self.context, 'edit')) 111 else: 112 self.redirect(self.url(self.context, 'manage')) 113 return -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/contracts.py
r12617 r12803 67 67 68 68 69 class RONContract(ContractBase): 69 class PCNContract(ContractBase): 70 """This is a sample contract. 71 """ 72 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 80 class RONContract(PCNContract): 70 81 """This is a sample contract. 71 82 """ … … 105 116 106 117 107 class ROPContract( ContractBase):118 class ROPContract(PCNContract): 108 119 """This is a sample contract. 109 120 """ … … 143 154 144 155 145 class RPRContract( ContractBase):156 class RPRContract(PCNContract): 146 157 """Registration in the Provisional Register contract. 147 158 """ … … 181 192 182 193 183 class RPCContract( ContractBase):194 class RPCContract(PCNContract): 184 195 """Registration as Pharmaceutical Chemist contract. 185 196 """ … … 219 230 220 231 221 class IPPMVLContract( ContractBase):232 class IPPMVLContract(PCNContract): 222 233 """Issuance of Patent and Proprietary Medicines Vendors License contract. 223 234 """ … … 257 268 258 269 259 class RPPMVLContract( ContractBase):270 class RPPMVLContract(PCNContract): 260 271 """Renewal of Patent and Proprietary Medicines Vendors License contract. 261 272 """ … … 295 306 296 307 297 class APPITContract( ContractBase):308 class APPITContract(PCNContract): 298 309 """Accepting Pupil Pharmacist for Internship Training contract. 299 310 """ … … 333 344 334 345 335 class RPTContract( ContractBase):346 class RPTContract(PCNContract): 336 347 """Registration as a Pharmacy Technician contract. 337 348 """ … … 371 382 372 383 373 class APPTContract( ContractBase):384 class APPTContract(PCNContract): 374 385 """Annual Permit for Pharmacy Technician contract. 375 386 """ -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/export.py
r12617 r12803 35 35 from ikobacustom.pcn.interfaces import MessageFactory as _ 36 36 37 37 38 class PCNCustomerExporter(CustomerExporter): 38 39 """Exporter for Customers. … … 49 50 title = _(u'PCN Customer JPG Documents') 50 51 class_name = 'PCNCustomerJPGDocument' 52 51 53 52 54 class PCNCustomerPDFDocumentExporter(CustomerDocumentExporterBase): … … 76 78 class_name = 'ROPContract' 77 79 80 78 81 class RPRContractExporter(ContractExporterBase): 79 82 """Exporter for Contract instances. … … 83 86 title = _(u'Licenses: Registration in the Provisional Register') 84 87 class_name = 'RPRContract' 88 85 89 86 90 class RPCContractExporter(ContractExporterBase): … … 92 96 class_name = 'RPCContract' 93 97 98 94 99 class IPPMVLContractExporter(ContractExporterBase): 95 100 """Exporter for Contract instances. … … 99 104 title = _(u'Licenses: Issuance of Patent and Proprietary Medicines Vendors') 100 105 class_name = 'IPPMVLContract' 106 101 107 102 108 class RPPMVLContractExporter(ContractExporterBase): … … 108 114 class_name = 'RPPMVLContract' 109 115 116 110 117 class APPITContractExporter(ContractExporterBase): 111 118 """Exporter for Contract instances. … … 115 122 title = _(u'Licenses: Accepting Pupil Pharmacist for Internship Training') 116 123 class_name = 'APPITContract' 124 117 125 118 126 class RPTContractExporter(ContractExporterBase): … … 124 132 class_name = 'RPTContract' 125 133 134 126 135 class APPTContractExporter(ContractExporterBase): 127 136 """Exporter for Contract instances. -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/interfaces.py
r12801 r12803 19 19 from zope import schema 20 20 from datetime import datetime 21 from zope.interface import Attribute, Interface 21 22 from zc.sourcefactory.basic import BasicSourceFactory 22 23 from waeup.ikoba.interfaces import IIkobaObject … … 38 39 def year_range(): 39 40 curr_year = datetime.now().year 40 return range(curr_year - 2 , curr_year + 5)41 return range(curr_year - 20, curr_year + 2) 41 42 42 43 class PracticeSource(BasicSourceFactory): … … 86 87 """ 87 88 89 class IPCNContract(IContract): 90 """A Retention of Name contract. 91 92 """ 93 contract_year = Attribute('Year of License') 94 95 88 96 # Customer contract interfaces 89 97 90 class IRONContract(I Contract):98 class IRONContract(IPCNContract): 91 99 """A Retention of Name contract. 92 100 … … 105 113 ) 106 114 107 year_qualification= schema.Choice(115 qualification_year = schema.Choice( 108 116 title = _(u'Year of Qualification'), 109 117 required = True, … … 182 190 183 191 184 class IROPContract(I Contract):192 class IROPContract(IPCNContract): 185 193 """A Registration of Premises contract. 186 194 … … 291 299 # ) 292 300 293 class IRPRContract(I Contract):301 class IRPRContract(IPCNContract): 294 302 """A Registration in the Provisional Register contract. 295 303 … … 425 433 426 434 427 class IRPCContract(I Contract):435 class IRPCContract(IPCNContract): 428 436 """A Registration as Pharmaceutical Chemist contract. 429 437 … … 570 578 'certificates_object'].order 571 579 572 class IIPPMVLContract(I Contract):580 class IIPPMVLContract(IPCNContract): 573 581 """A Issuance of Patent and Proprietary Medicines Vendors License. 574 582 … … 744 752 'incometax_object'].order 745 753 746 class IRPPMVLContract(I Contract):754 class IRPPMVLContract(IPCNContract): 747 755 """A Renewal of Patent and Proprietary Medicines Vendors License. 748 756 … … 876 884 """ 877 885 878 class IAPPITContract(I Contract):886 class IAPPITContract(IPCNContract): 879 887 """A Accepting Pupil Pharmacist for Internship Training contract. 880 888 … … 1020 1028 """ 1021 1029 1022 class IRPTContract(I Contract):1030 class IRPTContract(IPCNContract): 1023 1031 """A Registration as a Pharmacy Technician contract. 1024 1032 … … 1130 1138 """ 1131 1139 1132 class IAPPTContract(I Contract):1140 class IAPPTContract(IPCNContract): 1133 1141 """An Annual Permit for Pharmacy Technician contract. 1134 1142 -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_browser.py
r12798 r12803 224 224 result = open(self.outfile, 'rb').read() 225 225 self.assertMatches(result, 226 'categories_practice,class_name,comment,contract_category,contract_id,' 227 'fee_based,history,last_product_id,lga,nationality,product_object,' 228 'product_options,state,superintendent,' 229 'tc_dict,title,user_id,valid_from,valid_to,work_address,work_email,work_phone,' 230 'year_qualification\r\n' 231 '[],RONContract,,ron,%s,0,' 232 '[u\'2015-01-18 16:40:01 WAT - License created by system\'],,,,,' 233 '[],created,,{\'en\': u\'Hello World\'},,K1000000,,,,,,\r\n' 226 'categories_practice,class_name,comment,contract_category,' 227 'contract_id,contract_year,fee_based,history,last_product_id,' 228 'lga,nationality,product_object,product_options,' 229 'qualification_year,state,superintendent,tc_dict,' 230 'title,user_id,valid_from,valid_to,work_address,' 231 'work_email,work_phone\r\n' 232 '[],RONContract,,ron,%s,,0,' 233 '[u\'2015-03-20 19:13:53 WAT - License created by system\']' 234 ',,,,,[],,created,,{\'en\': u\'Hello World\'},,K1000000,,,,,\r\n' 234 235 % self.contract1.contract_id) 235 236 # We can reimport the file if we change the header … … 283 284 result = open(self.outfile, 'rb').read() 284 285 self.assertMatches(result, 285 'categories_practice,class_name,contract_category,contract_id,' 286 'date_of_qualification,fee_based,history,inspected,last_license_number,' 286 'categories_practice,class_name,contract_category,' 287 'contract_id,contract_year,date_of_qualification,' 288 'fee_based,history,inspected,last_license_number,' 287 289 'last_product_id,official_in_state,other_directors,' 288 290 'pharmacists_directors,premises_address,premises_certificate,' 289 'product_object,product_options,recommended, '290 's tate,superintendent,tc_dict,title,user_id,valid_from,valid_to,'291 ' work_address\r\n'292 293 '[],ROPContract,rop,%s,, 0,'294 '[u\'2015-0 1-20 18:51:03WAT - License created by system\']'291 'product_object,product_options,recommended,state,' 292 'superintendent,tc_dict,title,user_id,valid_from,' 293 'valid_to,work_address\r\n' 294 295 '[],ROPContract,rop,%s,,,0,' 296 '[u\'2015-03-20 19:18:30 WAT - License created by system\']' 295 297 ',,,,,,,,,,[],,created,,{\'en\': u\'Hello World\'},,K1000000,,,\r\n' 296 298 % self.contract2.contract_id) -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/products/interfaces.py
r12371 r12803 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 from zope import schema 18 19 from waeup.ikoba.products.interfaces import IProduct 19 20 from ikobacustom.pcn.interfaces import MessageFactory as _ … … 24 25 25 26 """ 27 28 contract_year = schema.Int( 29 title=u'Year of License', 30 description=_(u'Enter 4-digit license year.'), 31 required=False, 32 min=1990, 33 max=2050, 34 ) 35 36 IPCNProduct['contract_year'].order = IPCNProduct['valid_from'].order -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/products/tests/test_browser.py
r12686 r12803 54 54 result = open(self.outfile, 'rb').read() 55 55 self.assertEqual(result, 56 'contract_category,contract_title, description,options,'56 'contract_category,contract_title,contract_year,description,options,' 57 57 'product_id,terms_and_conditions,title,valid_from,valid_to,' 58 58 'users_with_local_roles\r\n' 59 'ron,,, [],RON,,Unnamed,2015-12-04#,,[]\r\n')59 'ron,,,,[],RON,,Unnamed,2015-12-04#,,[]\r\n') 60 60 # We can import the same file. 61 61 processor = PCNProductProcessor() … … 74 74 result = processor.doImport( 75 75 self.outfile, 76 ['contract_category','contract_title', 'description', 'options', 77 'product_id', 'terms_and_conditions','title','valid_from','valid_to', 76 ['contract_category','contract_title','contract_year', 77 'description', 'options', 78 'product_id', 'terms_and_conditions', 79 'title','valid_from','valid_to', 78 80 'users_with_local_roles'], 79 81 mode='create') … … 84 86 result = processor.doImport( 85 87 self.outfile, 86 ['contract_category','contract_title', 'description', 'options', 87 'product_id', 'terms_and_conditions','title','valid_from','valid_to', 88 ['contract_category','contract_title', 'contract_year', 89 'description', 'options', 90 'product_id', 'terms_and_conditions', 91 'title','valid_from','valid_to', 88 92 'users_with_local_roles'], 89 93 mode='update')
Note: See TracChangeset for help on using the changeset viewer.