Esempio n. 1
0
	def create_document_level0(self):	
			#webnotes.errprint("in document")
			c=Document('Employee Training Details')
			c.test= 'Level 0 Completed'
			c.is_pass= 1
			c.level= self.doc.training_level
			c.parent=self.doc.employee
			c.save()
Esempio n. 2
0
def update_test_log(test_details):
	#webnotes.errprint(emp)
	d = Document('Test Log')
	d.sample_no = test_details.get("sample_no")
	d.test = test_details.get("test")
	d.status = test_details.get("workflow_state")
	#webnotes.errprint(d.status)
	d.tester=test_details.get("tested_by")
	d.shift_incharge=test_details.get("shift_incharge")
	d.lab_incharge=test_details.get("lab_incharge")
	d.save()
	def create_test_preparation(self,test_name):
		if test_name == 'Neutralization Value':
			test_preparation = Document("Neutralization Value")
			test_preparation.tested_by = self.doc.tester 
			test_preparation.save() 

		else :
			test_preparation=Document("Test Preparation")
			test_preparation.test=test_name
			test_preparation.save()

		return test_preparation.name
	def create_test_document(self, samples, test_mapper):
		#webnotes.errprint("executing create_test_document")
		test_result = {}
		for test_name in test_mapper.get(self.doc.test):
			test = Document(test_name)
			
			if test_name == 'Neutralization Value':
				test.tested_by = samples[0][1] 
				test.specification=samples[0][2]
				test.save() 


			if test_name == 'Test Preparation':
				test.test = test_mapper.get(self.doc.test).get(test_name).get('type')
				test.save() 
				
			self.create_child_test_document(samples, test.name, test_name, test_mapper.get(self.doc.test).get(test_name))
			test_result[test_name] = test.name 
		#webnotes.errprint(test_result)
		return test_result
Esempio n. 5
0
	def on_submit(self):

		if self.doc.training_status=='Completed' or self.doc.training_status==None:

			tests=webnotes.conn.sql("select test from `tabTraining Details` where is_pass='******' and parent='"+self.doc.name+"' ")
			#webnotes.errprint(tests)
			if tests:
				for j in tests:
					#webnotes.errprint(j[0])
					d=Document('Employee Training Details')
					d.test= j[0]
					d.is_pass= 1
					d.level= self.doc.training_level
					d.parent=self.doc.employee
					d.save()
			self.create_email();
			self.assign_to();
			
			#For Level 0
			if self.doc.training_level=='Level 0':
				self.create_document_level0();

		else:
			webnotes.msgprint("For successful completion of form update Training Status to 'Completed' ",raise_exception=1)