Merge branch 'master' into ldap_integration
This commit is contained in:
commit
4ef4eaf785
5 changed files with 65 additions and 2 deletions
12
Changelog
12
Changelog
|
@ -1,3 +1,15 @@
|
|||
2.7.3: 2019-12-18
|
||||
* Bugfix: Swiss VAT being wrongly added to non-EU customers
|
||||
2.7.2: 2019-12-17
|
||||
* Add vat rates for AD, TK and IS
|
||||
* Improve billing address' string representation
|
||||
Notes for deployment:
|
||||
- Import the newly added vat rates into db
|
||||
```
|
||||
./manage.py import_vat_rates vat_rates.csv
|
||||
```
|
||||
2.7.1: 2019-12-14
|
||||
* feature: Add management command to list active VM customers (MR!723)
|
||||
2.7: 2019-12-9
|
||||
* feature: EU VAT for new subscriptions (MR!721)
|
||||
Notes for deployment:
|
||||
|
|
41
datacenterlight/management/commands/all_customers.py
Normal file
41
datacenterlight/management/commands/all_customers.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
import logging
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from hosting.models import (
|
||||
HostingOrder, VMDetail
|
||||
)
|
||||
from membership.models import CustomUser
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = '''Dumps the email addresses of all customers who have a VM'''
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('-a', '--all_registered', action='store_true',
|
||||
help='All registered users')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
all_registered = options['all_registered']
|
||||
all_customers_set = set()
|
||||
if all_registered:
|
||||
all_customers = CustomUser.objects.filter(
|
||||
is_admin=False, validated=True
|
||||
)
|
||||
for customer in all_customers:
|
||||
all_customers_set.add(customer.email)
|
||||
else:
|
||||
all_hosting_orders = HostingOrder.objects.filter()
|
||||
running_vm_details = VMDetail.objects.filter(terminated_at=None)
|
||||
running_vm_ids = [rvm.vm_id for rvm in running_vm_details]
|
||||
for order in all_hosting_orders:
|
||||
if order.vm_id in running_vm_ids:
|
||||
all_customers_set.add(order.customer.user.email)
|
||||
for cu in all_customers_set:
|
||||
print(cu)
|
||||
if all_registered:
|
||||
print("All registered users = %s" % len(all_customers_set))
|
||||
else:
|
||||
print("Total active customers = %s" % len(all_customers_set))
|
|
@ -619,6 +619,7 @@ class OrderConfirmationView(DetailView, FormView):
|
|||
vm_specs["vat_country"] = user_vat_country
|
||||
vm_specs["discount"] = discount
|
||||
vm_specs["total_price"] = round(price + vat - discount['amount'], 2)
|
||||
request.session['specs'] = vm_specs
|
||||
|
||||
context.update({
|
||||
'vm': vm_specs,
|
||||
|
|
|
@ -20,7 +20,10 @@ class BaseBillingAddress(models.Model):
|
|||
|
||||
class BillingAddress(BaseBillingAddress):
|
||||
def __str__(self):
|
||||
return self.street_address
|
||||
return "%s, %s, %s, %s, %s" % (
|
||||
self.cardholder_name, self.street_address, self.city,
|
||||
self.postal_code, self.country
|
||||
)
|
||||
|
||||
|
||||
class UserBillingAddress(BaseBillingAddress):
|
||||
|
@ -28,7 +31,10 @@ class UserBillingAddress(BaseBillingAddress):
|
|||
current = models.BooleanField(default=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.street_address
|
||||
return "%s, %s, %s, %s, %s" % (
|
||||
self.cardholder_name, self.street_address, self.city,
|
||||
self.postal_code, self.country
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
|
|
|
@ -316,3 +316,6 @@ IM",GBP,0.1,standard,
|
|||
2019-11-15,,FR,EUR,0.2,standard,France standard VAT (added manually)
|
||||
2019-11-15,,GR,EUR,0.24,standard,Greece standard VAT (added manually)
|
||||
2019-11-15,,GB,EUR,0.2,standard,UK standard VAT (added manually)
|
||||
2019-12-17,,AD,EUR,0.045,standard,Andorra standard VAT (added manually)
|
||||
2019-12-17,,TK,EUR,0.18,standard,Turkey standard VAT (added manually)
|
||||
2019-12-17,,IS,EUR,0.24,standard,Iceland standard VAT (added manually)
|
||||
|
|
|
Loading…
Reference in a new issue