Browse Source

invoice: added attr 'invoice_url'

Fabian Peter Hammerle 6 years ago
parent
commit
0239c16950
3 changed files with 10 additions and 3 deletions
  1. 4 0
      finoex/__init__.py
  2. 1 1
      setup.py
  3. 5 2
      tests/test_yaml.py

+ 4 - 0
finoex/__init__.py

@@ -151,6 +151,7 @@ class Invoice(_Object, _ItemCollection, _YamlInitConstructor, _YamlVarsRepresent
                  invoice_date,
                  invoice_id,
                  discounts=None,
+                 invoice_url=None,
                  items=None
                  ):
         assert isinstance(creditor, str)
@@ -168,6 +169,9 @@ class Invoice(_Object, _ItemCollection, _YamlInitConstructor, _YamlVarsRepresent
             self.discounts = discounts
         else:
             self.discounts = []
+        if invoice_url:
+            assert isinstance(invoice_url, str)
+            self.invoice_url = invoice_url
         _ItemCollection.__init__(self, items)
 
 

+ 1 - 1
setup.py

@@ -4,7 +4,7 @@ import glob
 
 setup(
     name = 'finoex',
-    version = '0.11.2',
+    version = '0.12.0',
     # description = '',
     author = 'Fabian Peter Hammerle',
     author_email = 'fabian.hammerle@gmail.com',

+ 5 - 2
tests/test_yaml.py

@@ -259,9 +259,10 @@ def get_order_c():
 def get_invoice(items = True, discounts = True):
     inv = finoex.Invoice(
             creditor = u'platformπ',
-            invoice_id = u'id',
-            invoice_date = datetime.datetime(2016, 5, 8, 0, 18, 17),
             debitor_id = u'customer',
+            invoice_date = datetime.datetime(2016, 5, 8, 0, 18, 17),
+            invoice_id = u'id',
+            invoice_url = 'http://example.com/invoice.pdf',
             )
     if items:
         inv.items.append(get_item_a())
@@ -495,6 +496,7 @@ discounts:
   name: discount a
 invoice_date: 2016-05-08 00:18:17
 invoice_id: id
+invoice_url: http://example.com/invoice.pdf
 items:
 - !item
   name: item a
@@ -702,6 +704,7 @@ creditor: platformπ
 debitor_id: customer
 invoice_date: 2016-05-08T00:18:17
 invoice_id: id
+invoice_url: http://example.com/invoice.pdf
 items:
 - !item
   name: item a