Read VM_BASE_PRICE from env

This commit is contained in:
PCoder 2020-02-03 11:37:30 +05:30
parent 5d977f32d3
commit 00b434efb9
2 changed files with 5 additions and 1 deletions

View file

@ -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')
PRE_EU_VAT_RATE = float(env('PRE_EU_VAT_RATE'))
VM_BASE_PRICE = float(env('VM_BASE_PRICE'))
if DEBUG:
from .local import * # flake8: noqa

View file

@ -3,6 +3,8 @@ import logging
import math
import subprocess
from django.conf import settings
from oca.pool import WrongIdError
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(memory) * pricing.ram_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:
vat = decimal.Decimal(0)