Pass vm_pricing if available when creating HostingOrder

This commit is contained in:
PCoder 2018-04-16 03:37:19 +02:00
parent 25c0694b6c
commit b103772c0d

View file

@ -97,13 +97,26 @@ 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")
# Create a Hosting Order if 'pricing_name' in specs:
order = HostingOrder.create( vm_pricing = VMPricing.get_vm_pricing_by_name(
price=final_price, name=specs['pricing_name']
vm_id=vm_id, )
customer=customer, # Create a Hosting Order
billing_address=billing_address 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
order = HostingOrder.create(
price=final_price,
vm_id=vm_id,
customer=customer,
billing_address=billing_address
)
# Create a Hosting Bill # Create a Hosting Bill
HostingBill.create( HostingBill.create(