Skip to content
Snippets Groups Projects
Verified Commit 57479849 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Expect purchased items to list net prices

parent 5466eece
No related branches found
No related tags found
No related merge requests found
Pipeline #59961 failed
...@@ -19,6 +19,11 @@ Fixed ...@@ -19,6 +19,11 @@ Fixed
* Add a missing dependency for Sofort payments * Add a missing dependency for Sofort payments
Changed
~~~~~~~
* Purchased items are expected to list net prices
`1.0.2`_ - 2022-03-14 `1.0.2`_ - 2022-03-14
--------------------- ---------------------
......
...@@ -88,8 +88,8 @@ msgid "Can send invoice by email" ...@@ -88,8 +88,8 @@ msgid "Can send invoice by email"
msgstr "Kann Rechnung als E-Mail versenden" msgstr "Kann Rechnung als E-Mail versenden"
#: aleksis/apps/tezor/models/invoice.py:150 #: aleksis/apps/tezor/models/invoice.py:150
msgid "Included VAT {} %" msgid "VAT {} %"
msgstr "Enthaltene MwSt {} %" msgstr "MWSt. {} %"
#: aleksis/apps/tezor/models/invoice.py:158 #: aleksis/apps/tezor/models/invoice.py:158
msgid "Gross total" msgid "Gross total"
...@@ -104,8 +104,8 @@ msgid "Purchased item" ...@@ -104,8 +104,8 @@ msgid "Purchased item"
msgstr "Gekaufter Artikel" msgstr "Gekaufter Artikel"
#: aleksis/apps/tezor/models/invoice.py:180 #: aleksis/apps/tezor/models/invoice.py:180
msgid "Item gross price" msgid "Item net price"
msgstr "Artikel Bruttopreis" msgstr "Artikel-Nettopreis"
#: aleksis/apps/tezor/models/invoice.py:182 #: aleksis/apps/tezor/models/invoice.py:182
msgid "Currency" msgid "Currency"
......
...@@ -21,7 +21,7 @@ class Migration(migrations.Migration): ...@@ -21,7 +21,7 @@ class Migration(migrations.Migration):
('extended_data', models.JSONField(default=dict, editable=False)), ('extended_data', models.JSONField(default=dict, editable=False)),
('sku', models.CharField(blank=True, max_length=255, verbose_name='Article no.')), ('sku', models.CharField(blank=True, max_length=255, verbose_name='Article no.')),
('description', models.CharField(max_length=255, verbose_name='Purchased item')), ('description', models.CharField(max_length=255, verbose_name='Purchased item')),
('price', models.DecimalField(decimal_places=2, default='0.0', max_digits=9, verbose_name='Item gross price')), ('price', models.DecimalField(decimal_places=2, default='0.0', max_digits=9, verbose_name='Item net price')),
('currency', models.CharField(max_length=10, verbose_name='Currency')), ('currency', models.CharField(max_length=10, verbose_name='Currency')),
('tax_rate', models.DecimalField(decimal_places=1, default='0.0', max_digits=4, verbose_name='Tax rate')), ('tax_rate', models.DecimalField(decimal_places=1, default='0.0', max_digits=4, verbose_name='Tax rate')),
], ],
......
...@@ -168,13 +168,13 @@ class Invoice(BasePayment, PureDjangoModel): ...@@ -168,13 +168,13 @@ class Invoice(BasePayment, PureDjangoModel):
tax_amounts = {} tax_amounts = {}
for item in self.get_purchased_items(): for item in self.get_purchased_items():
tax_amounts.setdefault(item.tax_rate, 0) tax_amounts.setdefault(item.tax_rate, 0)
tax_amounts[item.tax_rate] += item.price / (item.tax_rate + 100) * item.tax_rate tax_amounts[item.tax_rate] += item.price * item.tax_rate
values = [] values = []
for tax_rate, total in tax_amounts.items(): for tax_rate, total in tax_amounts.items():
values.append( values.append(
{ {
"name": _("Included VAT {} %").format(tax_rate), "name": _("VAT {} %").format(tax_rate),
"value": total, "value": total,
"currency": self.currency, "currency": self.currency,
} }
...@@ -204,7 +204,7 @@ class InvoiceItem(ExtensibleModel): ...@@ -204,7 +204,7 @@ class InvoiceItem(ExtensibleModel):
sku = models.CharField(max_length=255, verbose_name=_("Article no."), blank=True) sku = models.CharField(max_length=255, verbose_name=_("Article no."), blank=True)
description = models.CharField(max_length=255, verbose_name=_("Purchased item")) description = models.CharField(max_length=255, verbose_name=_("Purchased item"))
price = models.DecimalField( price = models.DecimalField(
verbose_name=_("Item gross price"), max_digits=9, decimal_places=2, default="0.0" verbose_name=_("Item net price"), max_digits=9, decimal_places=2, default="0.0"
) )
currency = models.CharField(max_length=10, verbose_name=_("Currency")) currency = models.CharField(max_length=10, verbose_name=_("Currency"))
tax_rate = models.DecimalField( tax_rate = models.DecimalField(
......
...@@ -14,7 +14,7 @@ class PurchasedItemsTable(tables.Table): ...@@ -14,7 +14,7 @@ class PurchasedItemsTable(tables.Table):
) )
quantity = tables.Column(verbose_name=_("Qty."), attrs={"td": {"class": "right-align"}}) quantity = tables.Column(verbose_name=_("Qty."), attrs={"td": {"class": "right-align"}})
price = tables.TemplateColumn( price = tables.TemplateColumn(
verbose_name=_("Gross"), verbose_name=_("Net"),
template_code="{{value|floatformat:2}} {{record.currency}}", template_code="{{value|floatformat:2}} {{record.currency}}",
attrs={"td": {"class": "right-align"}}, attrs={"td": {"class": "right-align"}},
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment