mirror of
				https://github.com/itsdave-de/msp.git
				synced 2025-10-31 09:21:01 -03:00 
			
		
		
		
	#29 | Create method to set IT Object data in IP Address Doctypes in already existing doctypes
This commit is contained in:
		
							parent
							
								
									1a1fe4b98c
								
							
						
					
					
						commit
						7a5746fd27
					
				| @ -10,6 +10,9 @@ from frappe.model.document import Document | ||||
| class ITObject(Document): | ||||
|     def save(self, *args, **kwargs): | ||||
|         super().save(*args, **kwargs) | ||||
|         self.set_it_object_data_in_ip_address_doctype() | ||||
| 
 | ||||
|     def set_it_object_data_in_ip_address_doctype(self): | ||||
|         if not self.main_ip: | ||||
|             return | ||||
| 
 | ||||
| @ -92,3 +95,9 @@ class ITObject(Document): | ||||
|                 'status': 500, | ||||
|                 'response': f'Data could not be fetched from {msp_settings_doc.oitc_url}. Error -> {str(exception)}' | ||||
|             } | ||||
| 
 | ||||
| def set_it_object_data_in_ip_address_doctype_for_existing_it_objects(): | ||||
|         it_objects = frappe.db.get_all("IT Object", fields=['name']) | ||||
|         for it_object in it_objects: | ||||
|             it_object_doctype = frappe.get_doc("IT Object", it_object['name']) | ||||
|             it_object_doctype.set_it_object_data_in_ip_address_doctype() | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user