diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..13a8d06 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,3 @@ +[run] +source = + invoice_generator diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c4fd8fb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: python +cache: pip +sudo: false +python: + - "3.6" + - "3.5" + - "nightly" + - "pypy3" +install: + - pip install codecov coverage +matrix: + allow_failures: + - python: "nightly" + - python: "pypy3" +script: + - pip3 install -e ".[testing]" + - coverage run -m unittest discover -s tests +after_success: + - codecov diff --git a/invoice_generator/models.py b/invoice_generator/models.py index 37b1974..a96fe18 100644 --- a/invoice_generator/models.py +++ b/invoice_generator/models.py @@ -105,7 +105,7 @@ class Invoice(object): def __init__(self, order_data: Order, vendor: Vendor, billing_address: Address, - *items: OrderItem): + items: OrderItem): self.order = order_data self.vendor = vendor self.billing_address = billing_address diff --git a/invoice_generator/templates/index.html b/invoice_generator/templates/index.html index 1824738..b601327 100644 --- a/invoice_generator/templates/index.html +++ b/invoice_generator/templates/index.html @@ -1,179 +1,180 @@ {% load i18n %} -
- - - - -- {{ vendor.address.name }}, - {{ vendor.address.street }}, - {{ vendor.address.postcode }} {{ vendor.address.city }} - | -
+ {{ vendor.address.name }}, + {{ vendor.address.street }}, + {{ vendor.address.postcode }} {{ vendor.address.city }} + | +
{{ billing_address.name }} | -
{{ billing_address.name }} | +
{{ billing_address.street }} | -
{{ billing_address.street }} | +
- {{ billing_address.postcode }} - {{ billing_address.city }} - | -
- - {% blocktrans with order_id=order.order_id %}Order ID: {{ order_id }}{% endblocktrans %} - - | +
+ {% blocktrans with order_id=order.order_id %}Order ID: {{ order_id }}{% endblocktrans %} + | -- {% blocktrans with customer_id=order.customer_id %}Customer ID: {{ customer_id }}{% endblocktrans %} - | -
{% blocktrans %}The order will be shipped upon receipt of payment.{% endblocktrans %} | - {% endif %} -- {% blocktrans with date=order.date|date %}Date of Invoice: {{ date }}{% endblocktrans %} - | -
{% blocktrans %}REF{% endblocktrans %} | -{% blocktrans %}Description{% endblocktrans %} | -{% blocktrans %}Quantity{% endblocktrans %} | -{% blocktrans %}Price per Unit{% endblocktrans %} | -{% blocktrans %}Tax Rate{% endblocktrans %} | -{% blocktrans %}Net Price{% endblocktrans %} | -|
{{ item.reference }} | -{{ item.text|safe }} | -{{ item.quantity }} | -{{ item.net_price|floatformat:2 }} {{ currency }} | -{{ item.tax_rate }} % | -{{ item.total_net|floatformat:2 }} {{ currency }} | -|
- | ||||||
- | - | {% blocktrans %}Total discounted{% endblocktrans %} | -{{ order.total_discounted|floatformat:2 }} {{ currency }} | -|||
- | - | {% blocktrans %}Shipping{% endblocktrans %} | -{{ order.total_shipping_net|floatformat:2 }} {{ currency }} | -|||
- | - | {% blocktrans %}Net total{% endblocktrans %} | -{{ order.total_net|floatformat:2 }} {{ currency }} | -|||
- | - | {% blocktrans with tax=order.tax_rate %}VAT ({{ tax }}%){% endblocktrans %} | -{{ order.total_tax|floatformat:2 }} {{ currency }} | -|||
- | - | {% blocktrans %}Gross total{% endblocktrans %} | -{{ order.total_gross|floatformat:2 }} {{ currency }} | -
{% blocktrans %}Thank you for your order.{% endblocktrans %}
+{% blocktrans %}REF{% endblocktrans %} | +{% blocktrans %}Description{% endblocktrans %} | +{% blocktrans %}Quantity{% endblocktrans %} | +{% blocktrans %}Price per Unit{% endblocktrans %} | +{% blocktrans %}Tax Rate{% endblocktrans %} | +{% blocktrans %}Net Price{% endblocktrans %} | +|
{{ item.reference }} | +{{ item.text|safe }} | +{{ item.quantity }} | +{{ item.net_price|floatformat:2 }} {{ currency }} | +{{ item.tax_rate }} % | +{{ item.total_net|floatformat:2 }} {{ currency }} | +|
+ | ||||||
+ | + | {% blocktrans %}Total discounted{% endblocktrans %} | +{{ order.total_discounted|floatformat:2 }} {{ currency }} | +|||
+ | + | {% blocktrans %}Shipping{% endblocktrans %} | +{{ order.total_shipping_net|floatformat:2 }} {{ currency }} | +|||
+ | + | {% blocktrans %}Net total{% endblocktrans %} | +{{ order.total_net|floatformat:2 }} {{ currency }} | +|||
+ | + | {% blocktrans with tax=order.tax_rate %}VAT ({{ tax }}%){% endblocktrans %} | +{{ order.total_tax|floatformat:2 }} {{ currency }} | +|||
+ | + | {% blocktrans %}Gross total{% endblocktrans %} | +{{ order.total_gross|floatformat:2 }} {{ currency }} | +
{% blocktrans %}Thank you for your order.{% endblocktrans %}
- {% if order.pay_until_date %} -{% blocktrans with date=order.pay_until_date|date %}Please settle the payment by {{ date }}{% endblocktrans %}.
- {% endif %} + {% if order.pay_until_date %} +{% blocktrans with date=order.pay_until_date|date %}Please settle the payment by {{ date }}{% endblocktrans %}.
+ {% endif %} - {% if order.shipping_date_range %} -- {% blocktrans with from=order.shipping_from|date to=order.shipping_to|date %} - Order will be delivered between {{ from }} and {{ to }}. - {% endblocktrans %} -
- {% endif %} -+ {% blocktrans with from=order.shipping_from|date to=order.shipping_to|date %} + Order will be delivered between {{ from }} and {{ to }}. + {% endblocktrans %} +
+ {% endif %} +