add danish_vat field to creditnote model and template

This commit is contained in:
Thomas Steen Rasmussen 2017-09-17 15:00:38 +02:00
parent 0064d69d90
commit d14d67496d
3 changed files with 33 additions and 1 deletions

View file

@ -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?'),
),
]

View file

@ -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):

View file

@ -30,7 +30,11 @@
<tr>
<td align="right">
{% if creditnote.danish_vat %}
<strong>Danish VAT (25%)</strong>
{% else %}
<strong>No VAT</strong>
{% endif %}
<td align="right">
{{ creditnote.vat|currency }}