Fix a bug creating hostingorder
This commit is contained in:
parent
1e76864821
commit
3fca9dbb0d
1 changed files with 13 additions and 21 deletions
|
@ -97,30 +97,22 @@ 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(
|
||||||
vm_pricing = VMPricing.get_vm_pricing_by_name(
|
name=specs['pricing_name']
|
||||||
name=specs['pricing_name']
|
) if 'pricing_name' in specs else VMPricing.get_default_pricing()
|
||||||
)
|
# Create a Hosting Order
|
||||||
# Create a Hosting Order
|
order = HostingOrder.create(
|
||||||
order = HostingOrder.create(
|
price=final_price,
|
||||||
price=final_price,
|
vm_id=vm_id,
|
||||||
vm_id=vm_id,
|
customer=customer,
|
||||||
customer=customer,
|
billing_address=billing_address,
|
||||||
billing_address=billing_address,
|
vm_pricing=vm_pricing
|
||||||
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(
|
||||||
customer=customer, billing_address=billing_address)
|
customer=customer, billing_address=billing_address
|
||||||
|
)
|
||||||
|
|
||||||
# Create Billing Address for User if he does not have one
|
# Create Billing Address for User if he does not have one
|
||||||
if not customer.user.billing_addresses.count():
|
if not customer.user.billing_addresses.count():
|
||||||
|
|
Loading…
Reference in a new issue