Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
Can now pass order object through Order model
Browse files Browse the repository at this point in the history
+ Customer ID (optional) no longer shows "None" if not set.
  • Loading branch information
NyanKiyoshi committed Mar 26, 2018
1 parent 037da90 commit 00c5c58
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions invoice_generator/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def bottom_padding(self):

class Order(object):
__slots__ = (
'order_id', 'customer_id', 'date',
'order', 'order_id', 'customer_id', 'date',
'pay_until_date', 'shipping_date_range',
'tax_rate', 'total_discounted', 'total_shipping_net',
'total_tax', 'total_net', 'total_gross'
Expand All @@ -49,7 +49,9 @@ def __init__(self, invoice_id, customer_id, date,
payment_date_limit,
shipping_date_range: Tuple[dt_date, dt_date],
tax_rate, total_discounted, total_shipping_net,
total_tax, total_net, total_gross):
total_tax, total_net, total_gross, order=None):

self.order = order
self.order_id = invoice_id
self.customer_id = customer_id
self.date = date
Expand Down
8 changes: 5 additions & 3 deletions invoice_generator/templates/pdf_invoice.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@
<div class="section">
<table class="infoTable">
<tr>
<td class="bold">
{% blocktrans with order_id=order.order_id %}Order ID: {{ order_id }}{% endblocktrans %}
</td>
{% if order.order_id %}
<td class="bold">
{% blocktrans with order_id=order.order_id %}Order ID: {{ order_id }}{% endblocktrans %}
</td>
{% endif %}

<td>
{% blocktrans with customer_id=order.customer_id %}Customer ID: {{ customer_id }}{% endblocktrans %}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _get_test_suite():
author_email='[email protected]',
url='https://github.com/NyanKiyoshi/invoice-generator',

version='0.0.3rc3',
version='0.0.3rc4',
name=PKG_NAME,
packages=find_packages(exclude=['tests']),
include_package_data=True,
Expand Down

0 comments on commit 00c5c58

Please sign in to comment.