Refactor PRE_EU_VAT_RATE + fix >= for first_vm_id_after_eu_vat

This commit is contained in:
PCoder 2019-12-09 18:05:57 +05:30
parent 744e76c5df
commit a6695a103f
2 changed files with 14 additions and 7 deletions

View file

@ -727,7 +727,9 @@ AUTH_SEED = env('AUTH_SEED')
AUTH_REALM = env('AUTH_REALM')
OTP_SERVER = env('OTP_SERVER')
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'))
if DEBUG:

View file

@ -859,8 +859,8 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView, FormView):
if obj.vm_pricing else 'default'),
vat_rate= (
user_country_vat_rate * 100
if obj.vm_id > settings.FIRST_VM_ID_AFTER_EU_VAT
else 7.7
if obj.vm_id >= settings.FIRST_VM_ID_AFTER_EU_VAT
else settings.PRE_EU_VAT_RATE
)
)
context['vm']["after_eu_vat_intro"] = (
@ -893,8 +893,8 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView, FormView):
if obj.vm_pricing else 'default'),
vat_rate=(
user_country_vat_rate * 100
if obj.vm_id > settings.FIRST_VM_ID_AFTER_EU_VAT
else 7.7
if obj.vm_id >= settings.FIRST_VM_ID_AFTER_EU_VAT
else settings.PRE_EU_VAT_RATE
)
)
context['vm']["after_eu_vat_intro"] = (
@ -1293,8 +1293,8 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
if obj.order.vm_pricing else 'default'),
vat_rate=(
user_country_vat_rate * 100
if obj.order.vm_id > settings.FIRST_VM_ID_AFTER_EU_VAT
else 7.7
if obj.order.vm_id >= settings.FIRST_VM_ID_AFTER_EU_VAT
else settings.PRE_EU_VAT_RATE
)
)
context['vm']["after_eu_vat_intro"] = (
@ -1322,7 +1322,12 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
ssd_size=context['vm']['disk_size'],
memory=context['vm']['memory'],
pricing_name=(obj.order.vm_pricing.name
if obj.order.vm_pricing else 'default')
if obj.order.vm_pricing else 'default'),
vat_rate=(
user_country_vat_rate * 100
if obj.order.vm_id >= settings.FIRST_VM_ID_AFTER_EU_VAT
else settings.PRE_EU_VAT_RATE
)
)
context['vm']['vat'] = vat
context['vm']['price'] = price