add danish_vat field to creditnote model and template
This commit is contained in:
parent
0064d69d90
commit
d14d67496d
20
src/shop/migrations/0051_creditnote_danish_vat.py
Normal file
20
src/shop/migrations/0051_creditnote_danish_vat.py
Normal 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?'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -410,6 +410,11 @@ class CreditNote(CreatedUpdatedModel):
|
||||||
default='',
|
default='',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
danish_vat = models.BooleanField(
|
||||||
|
help_text="Danish VAT?",
|
||||||
|
default=True
|
||||||
|
)
|
||||||
|
|
||||||
paid = models.BooleanField(
|
paid = models.BooleanField(
|
||||||
verbose_name=_('Paid?'),
|
verbose_name=_('Paid?'),
|
||||||
help_text=_('Whether the amount in this creditnote has been paid back to the customer.'),
|
help_text=_('Whether the amount in this creditnote has been paid back to the customer.'),
|
||||||
|
@ -447,7 +452,10 @@ class CreditNote(CreatedUpdatedModel):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def vat(self):
|
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
|
@property
|
||||||
def filename(self):
|
def filename(self):
|
||||||
|
|
|
@ -30,7 +30,11 @@
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
|
{% if creditnote.danish_vat %}
|
||||||
<strong>Danish VAT (25%)</strong>
|
<strong>Danish VAT (25%)</strong>
|
||||||
|
{% else %}
|
||||||
|
<strong>No VAT</strong>
|
||||||
|
{% endif %}
|
||||||
<td align="right">
|
<td align="right">
|
||||||
{{ creditnote.vat|currency }}
|
{{ creditnote.vat|currency }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue