Pass vm_pricing if available when creating HostingOrder
This commit is contained in:
		
					parent
					
						
							
								25c0694b6c
							
						
					
				
			
			
				commit
				
					
						b103772c0d
					
				
			
		
					 1 changed files with 20 additions and 7 deletions
				
			
		| 
						 | 
					@ -97,6 +97,19 @@ def create_vm_task(self, vm_template_id, user, specs, template,
 | 
				
			||||||
        if vm_id is None:
 | 
					        if vm_id is None:
 | 
				
			||||||
            raise Exception("Could not create VM")
 | 
					            raise Exception("Could not create VM")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if 'pricing_name' in specs:
 | 
				
			||||||
 | 
					            vm_pricing = VMPricing.get_vm_pricing_by_name(
 | 
				
			||||||
 | 
					                name=specs['pricing_name']
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					            # Create a Hosting Order
 | 
				
			||||||
 | 
					            order = HostingOrder.create(
 | 
				
			||||||
 | 
					                price=final_price,
 | 
				
			||||||
 | 
					                vm_id=vm_id,
 | 
				
			||||||
 | 
					                customer=customer,
 | 
				
			||||||
 | 
					                billing_address=billing_address,
 | 
				
			||||||
 | 
					                vm_pricing=vm_pricing
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
            # Create a Hosting Order
 | 
					            # Create a Hosting Order
 | 
				
			||||||
            order = HostingOrder.create(
 | 
					            order = HostingOrder.create(
 | 
				
			||||||
                price=final_price,
 | 
					                price=final_price,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue