Read VM_BASE_PRICE from env
This commit is contained in:
parent
5d977f32d3
commit
00b434efb9
2 changed files with 5 additions and 1 deletions
|
@ -761,6 +761,7 @@ OTP_VERIFY_ENDPOINT = env('OTP_VERIFY_ENDPOINT')
|
||||||
FIRST_VM_ID_AFTER_EU_VAT = int_env('FIRST_VM_ID_AFTER_EU_VAT')
|
FIRST_VM_ID_AFTER_EU_VAT = int_env('FIRST_VM_ID_AFTER_EU_VAT')
|
||||||
PRE_EU_VAT_RATE = float(env('PRE_EU_VAT_RATE'))
|
PRE_EU_VAT_RATE = float(env('PRE_EU_VAT_RATE'))
|
||||||
|
|
||||||
|
VM_BASE_PRICE = float(env('VM_BASE_PRICE'))
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
from .local import * # flake8: noqa
|
from .local import * # flake8: noqa
|
||||||
|
|
|
@ -3,6 +3,8 @@ import logging
|
||||||
import math
|
import math
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from oca.pool import WrongIdError
|
from oca.pool import WrongIdError
|
||||||
|
|
||||||
from datacenterlight.models import VMPricing
|
from datacenterlight.models import VMPricing
|
||||||
|
@ -154,7 +156,8 @@ def get_vm_price_with_vat(cpu, memory, ssd_size, hdd_size=0,
|
||||||
(decimal.Decimal(cpu) * pricing.cores_unit_price) +
|
(decimal.Decimal(cpu) * pricing.cores_unit_price) +
|
||||||
(decimal.Decimal(memory) * pricing.ram_unit_price) +
|
(decimal.Decimal(memory) * pricing.ram_unit_price) +
|
||||||
(decimal.Decimal(ssd_size) * pricing.ssd_unit_price) +
|
(decimal.Decimal(ssd_size) * pricing.ssd_unit_price) +
|
||||||
(decimal.Decimal(hdd_size) * pricing.hdd_unit_price)
|
(decimal.Decimal(hdd_size) * pricing.hdd_unit_price) +
|
||||||
|
decimal.Decimal(settings.VM_BASE_PRICE)
|
||||||
)
|
)
|
||||||
if pricing.vat_inclusive:
|
if pricing.vat_inclusive:
|
||||||
vat = decimal.Decimal(0)
|
vat = decimal.Decimal(0)
|
||||||
|
|
Loading…
Reference in a new issue