Skip to content

Commit

Permalink
Disable converting datetime to string on Invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
rbas committed Jul 1, 2014
1 parent 0bd5775 commit 4b32182
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions InvoiceGenerator/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from PIL import Image
import qrcode
import datetime

from conf import _

Expand Down Expand Up @@ -142,7 +143,7 @@ def tax(self, value):

class Invoice(UnicodeProperty):
_attrs = ('title', 'variable_symbol', 'specific_symbol', 'paytype',
'currency', 'currency_locale', 'date', 'payback', 'taxable_date')
'currency', 'currency_locale')

rounding_result = False

Expand All @@ -155,6 +156,9 @@ def __init__(self, client, provider, creator):
self.provider = provider
self.creator = creator
self._items = []
self.date = None
self.payback = None
self.taxable_date = None

for attr in self._attrs:
self.__setattr__(attr, '')
Expand Down Expand Up @@ -240,13 +244,16 @@ def _fill(self, invoice):
qr_kwargs = {
'account': invoice.provider.bank_account,
'amount': invoice.price_tax,
'x_vs': invoice.variable_symbol,
'x_ss': invoice.specific_symbol,
}
if invoice.variable_symbol:
qr_kwargs['x_vs'] = invoice.variable_symbol
if invoice.variable_symbol:
qr_kwargs['x_ss'] = invoice.specific_symbol
if invoice.payback:
qr_kwargs['due_date'] = invoice.payback

try:
qr_kwargs['due_date'] = invoice.payback.strftime("%Y%m%d")
except AttributeError:
pass

qr_kwargs = {k: v for k, v in qr_kwargs.items() if v}

return QRPlatbaGenerator(**qr_kwargs)

Expand Down

0 comments on commit 4b32182

Please sign in to comment.