Add eu vat code
This commit is contained in:
parent
fcc671a707
commit
cc027c2497
1 changed files with 11 additions and 1 deletions
|
@ -1317,7 +1317,10 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
|
||||||
)
|
)
|
||||||
vm = manager.get_vm(vm_id)
|
vm = manager.get_vm(vm_id)
|
||||||
context['vm'] = VirtualMachineSerializer(vm).data
|
context['vm'] = VirtualMachineSerializer(vm).data
|
||||||
price, vat, vat_percent, discount = get_vm_price_with_vat(
|
user_vat_country = obj.order.billing_address.country
|
||||||
|
user_country_vat_rate = get_vat_rate_for_country(
|
||||||
|
user_vat_country)
|
||||||
|
price, vat, vat_percent, discount = get_vm_price_for_given_vat(
|
||||||
cpu=context['vm']['cores'],
|
cpu=context['vm']['cores'],
|
||||||
ssd_size=context['vm']['disk_size'],
|
ssd_size=context['vm']['disk_size'],
|
||||||
memory=context['vm']['memory'],
|
memory=context['vm']['memory'],
|
||||||
|
@ -1333,6 +1336,13 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
|
||||||
True if obj.order.vm_id >= settings.FIRST_VM_ID_AFTER_EU_VAT
|
True if obj.order.vm_id >= settings.FIRST_VM_ID_AFTER_EU_VAT
|
||||||
else False
|
else False
|
||||||
)
|
)
|
||||||
|
context['vm']["price"] = price
|
||||||
|
context['vm']["vat"] = vat
|
||||||
|
context['vm']["vat_percent"] = vat_percent
|
||||||
|
context['vm']["vat_country"] = user_vat_country
|
||||||
|
context['vm']["discount"] = discount
|
||||||
|
context['vm']["total_price"] = round(
|
||||||
|
price + vat - discount['amount'], 2)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
logger.error("Type error. Probably we "
|
logger.error("Type error. Probably we "
|
||||||
"came from a generic product. "
|
"came from a generic product. "
|
||||||
|
|
Loading…
Reference in a new issue