make it possible to have customorders and invoices without Danish VAT

This commit is contained in:
Thomas Steen Rasmussen 2017-09-14 21:02:59 +02:00
parent a1f30ccad5
commit 4c621aed4b
3 changed files with 39 additions and 2 deletions

View file

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-09-14 18:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0048_product_ticket_type'),
]
operations = [
migrations.AddField(
model_name='customorder',
name='danish_vat',
field=models.BooleanField(default=True, help_text='Danish VAT?'),
),
migrations.AlterField(
model_name='customorder',
name='paid',
field=models.BooleanField(default=False, help_text='Check when this custom order has been paid (or if it gets cancelled out by a Credit Note)', verbose_name='Paid?'),
),
]

View file

@ -41,16 +41,24 @@ class CustomOrder(CreatedUpdatedModel):
paid = models.BooleanField( paid = models.BooleanField(
verbose_name=_('Paid?'), verbose_name=_('Paid?'),
help_text=_('Whether this custom order has been paid.'), help_text=_('Check when this custom order has been paid (or if it gets cancelled out by a Credit Note)'),
default=False, default=False,
) )
danish_vat = models.BooleanField(
help_text="Danish VAT?",
default=True
)
def __str__(self): def __str__(self):
return 'custom order id #%s' % self.pk return 'custom order id #%s' % self.pk
@property @property
def vat(self): def vat(self):
if self.danish_vat:
return Decimal(round(self.amount*Decimal(0.2), 2)) return Decimal(round(self.amount*Decimal(0.2), 2))
else:
return 0
class Order(CreatedUpdatedModel): class Order(CreatedUpdatedModel):

View file

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