diff --git a/src/shop/migrations/0051_creditnote_danish_vat.py b/src/shop/migrations/0051_creditnote_danish_vat.py new file mode 100644 index 00000000..c2ad3508 --- /dev/null +++ b/src/shop/migrations/0051_creditnote_danish_vat.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-09-17 12:59 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0050_auto_20170916_1336'), + ] + + operations = [ + migrations.AddField( + model_name='creditnote', + name='danish_vat', + field=models.BooleanField(default=True, help_text='Danish VAT?'), + ), + ] diff --git a/src/shop/models.py b/src/shop/models.py index 935f3e39..a9af3b0a 100644 --- a/src/shop/models.py +++ b/src/shop/models.py @@ -410,6 +410,11 @@ class CreditNote(CreatedUpdatedModel): default='', ) + danish_vat = models.BooleanField( + help_text="Danish VAT?", + default=True + ) + paid = models.BooleanField( verbose_name=_('Paid?'), help_text=_('Whether the amount in this creditnote has been paid back to the customer.'), @@ -447,7 +452,10 @@ class CreditNote(CreatedUpdatedModel): @property def vat(self): - return Decimal(self.amount*Decimal(0.2)) + if self.danish_vat: + return Decimal(round(self.amount*Decimal(0.2), 2)) + else: + return 0 @property def filename(self): diff --git a/src/shop/templates/pdf/creditnote.html b/src/shop/templates/pdf/creditnote.html index 8b50659b..88070f0a 100644 --- a/src/shop/templates/pdf/creditnote.html +++ b/src/shop/templates/pdf/creditnote.html @@ -30,7 +30,11 @@