Changeset 12210
- Timestamp:
- 13 Dec 2014, 08:58:43 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12196 r12210 841 841 grok.require('waeup.viewCustomer') 842 842 grok.template('documentpage') 843 form_fields = grok.AutoFields(ICustomerDocument) .omit('last_transition_date')843 form_fields = grok.AutoFields(ICustomerDocument) 844 844 pnav = 4 845 845 … … 856 856 grok.require('waeup.manageCustomer') 857 857 grok.template('documenteditpage') 858 form_fields = grok.AutoFields(ICustomerDocument) .omit('last_transition_date')858 form_fields = grok.AutoFields(ICustomerDocument) 859 859 pnav = 4 860 860 deletion_warning = _('Are you sure?') … … 1008 1008 'suspended_comment',) 1009 1009 1010 #form_fields = grok.AutoFields(ICustomerPDFDocument).omit(1011 # 'last_transition_date')1012 1010 form_fields =() 1013 1011 … … 1180 1178 @property 1181 1179 def form_fields(self): 1182 form_fields = grok.AutoFields(self.context.form_fields_interface).omit( 1183 'last_transition_date') 1180 form_fields = grok.AutoFields(self.context.form_fields_interface) 1184 1181 for field in form_fields: 1185 1182 if field.__name__.endswith('_object'): … … 1204 1201 @property 1205 1202 def form_fields(self): 1206 return grok.AutoFields(self.context.form_fields_interface).omit( 1207 'last_transition_date') 1203 return grok.AutoFields(self.context.form_fields_interface) 1208 1204 1209 1205 @property … … 1225 1221 @property 1226 1222 def form_fields(self): 1227 return grok.AutoFields(self.context.edit_form_fields_interface).omit( 1228 'last_transition_date') 1223 return grok.AutoFields(self.context.edit_form_fields_interface) 1229 1224 1230 1225 def update(self): … … 1354 1349 'suspended_comment',) 1355 1350 1356 form_fields = grok.AutoFields(ISampleContract).omit( 1357 'last_transition_date') 1351 form_fields = grok.AutoFields(ISampleContract) 1358 1352 1359 1353 @property -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/contracts.py
r12196 r12210 107 107 def formatted_transition_date(self): 108 108 try: 109 return self. last_transition_date.strftime('%Y-%m-%d %H:%M:%S')110 except AttributeError:109 return self.history.messages[-1].split(' - ')[0] 110 except IndexError: 111 111 return 112 112 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12167 r12210 286 286 ) 287 287 288 last_transition_date = schema.Datetime(289 title = _(u'Last Transition Date'),290 required = False,291 readonly = False,292 )293 294 288 product_object = schema.Choice( 295 289 title = _(u'Product'), -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py
r12146 r12210 161 161 self.assertEqual( 162 162 result, 163 'class_name,document_id,history, last_transition_date,state,title,user_id\r\n'164 'CustomerSampleDocument,d101,[],,, ,\r\n'163 'class_name,document_id,history,state,title,user_id\r\n' 164 'CustomerSampleDocument,d101,[],,,\r\n' 165 165 ) 166 166 return … … 175 175 result = open(self.outfile, 'rb').read() 176 176 self.assertTrue( 177 'class_name,document_id,history, last_transition_date,state,title,user_id\r\n'177 'class_name,document_id,history,state,title,user_id\r\n' 178 178 in result 179 179 ) 180 180 self.assertMatches( 181 181 '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - ' 182 'Document created by system\'], 2014-11-25 06:57:24.990308#,'182 'Document created by system\'],' 183 183 'verified,My Document,A111111...', 184 184 result … … 194 194 result = open(self.outfile, 'rb').read() 195 195 self.assertTrue( 196 'class_name,document_id,history, last_transition_date,state,title,user_id\r\n'196 'class_name,document_id,history,state,title,user_id\r\n' 197 197 in result) 198 198 self.assertMatches( 199 199 '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - ' 200 'Document created by system\'], 2014-11-25 06:57:24.990308#,'200 'Document created by system\'],' 201 201 'verified,My Document,A111111...', 202 202 result … … 212 212 result = open(self.outfile, 'rb').read() 213 213 self.assertTrue( 214 'class_name,document_id,history, last_transition_date,state,title,user_id\r\n'214 'class_name,document_id,history,state,title,user_id\r\n' 215 215 in result) 216 216 self.assertMatches( 217 217 '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - ' 218 'Document created by system\'], 2014-11-25 06:57:24.990308#,'218 'Document created by system\'],' 219 219 'verified,My Document,A111111...', 220 220 result … … 254 254 result, 255 255 'class_name,contract_category,contract_id,document_object,' 256 'history,last_product_id, last_transition_date,'256 'history,last_product_id,' 257 257 'product_object,state,title\r\n' 258 258 259 'SampleContract,sample,c101,,[],,,, ,\r\n'259 'SampleContract,sample,c101,,[],,,,\r\n' 260 260 ) 261 261 return … … 270 270 self.assertMatches( 271 271 'class_name,contract_category,contract_id,document_object,' 272 'history,last_product_id, last_transition_date,'272 'history,last_product_id,' 273 273 'product_object,state,title\r\n' 274 274 275 275 'SampleContract,sample,c101,d101,[u\'2014-12-04 12:10:46 UTC - ' 276 276 'Contract record created by system\'],,' 277 ' 2014-12-04 12:10:46.333445#,SAM,created,My Contract\r\n',277 'SAM,created,My Contract\r\n', 278 278 result 279 279 ) … … 289 289 self.assertMatches( 290 290 'class_name,contract_category,contract_id,document_object,' 291 'history,last_product_id, last_transition_date,'291 'history,last_product_id,' 292 292 'product_object,state,title\r\n' 293 293 294 294 'SampleContract,sample,c101,d101,[u\'2014-12-04 12:10:46 UTC - ' 295 295 'Contract record created by system\'],,' 296 ' 2014-12-04 12:10:46.333445#,SAM,created,My Contract\r\n',296 'SAM,created,My Contract\r\n', 297 297 result 298 298 ) … … 308 308 self.assertMatches( 309 309 'class_name,contract_category,contract_id,document_object,' 310 'history,last_product_id, last_transition_date,'310 'history,last_product_id,' 311 311 'product_object,state,title\r\n' 312 312 313 313 'SampleContract,sample,c101,d101,[u\'2014-12-04 12:10:46 UTC - ' 314 314 'Contract record created by system\'],,' 315 ' 2014-12-04 12:10:46.333445#,SAM,created,My Contract\r\n',316 result 317 ) 318 return 319 315 'SAM,created,My Contract\r\n', 316 result 317 ) 318 return 319 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/workflow.py
r12168 r12210 241 241 @grok.subscribe(IContract, IWorkflowTransitionEvent) 242 242 def handle_contract_transition_event(obj, event): 243 """Append message to contract history and log file, also update 244 last_transition_date when transition happened. 243 """Append message to contract history and log file. 245 244 246 245 Undo the approval of contract and raise an exception if contract … … 256 255 history = IObjectHistory(obj) 257 256 history.addMessage(msg) 258 obj.last_transition_date = datetime.utcnow()259 257 try: 260 258 customers_container = grok.getSite()['customers'] -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py
r12204 r12210 86 86 def formatted_transition_date(self): 87 87 try: 88 return self. last_transition_date.strftime('%Y-%m-%d %H:%M:%S')89 except AttributeError:88 return self.history.messages[-1].split(' - ')[0] 89 except IndexError: 90 90 return 91 91 -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py
r12200 r12210 54 54 ) 55 55 56 last_transition_date = schema.Datetime(57 title = _(u'Last Transition Date'),58 required = False,59 readonly = False,60 )61 62 56 def setMD5(): 63 57 """Determine md5 checksum of selected files and store checksums as -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/workflow.py
r12200 r12210 134 134 @grok.subscribe(IDocument, IWorkflowTransitionEvent) 135 135 def handle_document_transition_event(obj, event): 136 """Append message to document history and log file and update 137 last_transition_date when transition happened. 136 """Append message to document history and log file. 138 137 139 138 Undo the verification of document and raise an exception if document … … 151 150 history = IObjectHistory(obj) 152 151 history.addMessage(msg) 153 obj.last_transition_date = datetime.utcnow()154 152 try: 155 153 customers_container = grok.getSite()['customers']
Note: See TracChangeset for help on using the changeset viewer.