gnucash maint: Fix a few typos in python example scripts and align them with the latest api changes

Geert Janssens gjanssens at code.gnucash.org
Mon Nov 17 12:00:22 EST 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/e59c3e06 (commit)
	from  https://github.com/Gnucash/gnucash/commit/22490a37 (commit)



commit e59c3e0639470bcdca39970ef8f7ff00849ec4e0
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Nov 17 17:45:40 2014 +0100

    Fix a few typos in python example scripts and align them with the latest api changes

diff --git a/src/optional/python-bindings/example_scripts/simple_business_create.py b/src/optional/python-bindings/example_scripts/simple_business_create.py
index adeb97a..40a2c3a 100644
--- a/src/optional/python-bindings/example_scripts/simple_business_create.py
+++ b/src/optional/python-bindings/example_scripts/simple_business_create.py
@@ -163,10 +163,10 @@ try:
     invoice_entry.SetDateEntered(datetime.datetime.now())
 
     invoice_customer.PostToAccount(a2, datetime.date.today(), datetime.date.today(),
-                                   "the memo", True)
+                                   "the memo", True, False)
 
     new_customer.ApplyPayment(None, None, a2, a6, GncNumeric(100,100),
-                              GncNumeric(1), datetime.date.today(), "", "")
+                              GncNumeric(1), datetime.date.today(), "", "", True)
 
     invoice_customer.ApplyPayment(None, a6, GncNumeric(7,100),
                                   GncNumeric(1), datetime.date.today(), "", "")
diff --git a/src/optional/python-bindings/example_scripts/simple_invoice_insert.py b/src/optional/python-bindings/example_scripts/simple_invoice_insert.py
index ace1f57..cab1769 100644
--- a/src/optional/python-bindings/example_scripts/simple_invoice_insert.py
+++ b/src/optional/python-bindings/example_scripts/simple_invoice_insert.py
@@ -22,11 +22,12 @@
 # @author Mark Jenkins, ParIT Worker Co-operative <mark at parit.ca>
 
 # Opens a GnuCash book file and adds an invoice to it for a particular
-# customer (by GUID) with a specific ID and value 
+# customer (by ID) with a specific ID and value 
+# Optionally also adds a payment for the invoice as well
 #
 # The account tree and tax tables are assumed to be the same as the ones
 # created in simple_business_create.py, but you can edit that to adapt
-# this to become an invoice imported for your own books
+# this to become an invoice importer for your own books
 #
 # Syntax:
 # gnucash-env python simple_invoice_insert.py \
@@ -86,20 +87,18 @@ def gnc_numeric_from_decimal(decimal_value):
 
 
 s = Session(argv[1], is_new=False)
-# this seems to make a difference in more complex cases
-s.save()
 
 book = s.book
 root = book.get_root_account()
 commod_table = book.get_table()
 CAD = commod_table.lookup('CURRENCY', 'CAD')
 
-my_customer = book.LookupByID(arg[2])
+my_customer = book.CustomerLookupByID(argv[2])
 assert( my_customer != None )
 assert( isinstance(my_customer, Customer) )
 
 assets = root.lookup_by_name("Assets")
-recievables = assets.lookup_by_name("Recievables")
+receivables = assets.lookup_by_name("Receivables")
 income = root.lookup_by_name("Income")
 
 invoice = Invoice(book, argv[3], CAD, my_customer )
@@ -114,8 +113,8 @@ invoice_entry.SetQuantity( GncNumeric(1) )
 invoice_entry.SetInvAccount(income)
 invoice_entry.SetInvPrice(invoice_value)
 
-invoice.PostToAccount(recievables, datetime.date.today(), datetime.date.today(),
-                      "", True)
+invoice.PostToAccount(receivables, datetime.date.today(), datetime.date.today(),
+                      "", True, False)
 
 s.save()
 s.end()



Summary of changes:
 .../example_scripts/simple_business_create.py             |  4 ++--
 .../example_scripts/simple_invoice_insert.py              | 15 +++++++--------
 2 files changed, 9 insertions(+), 10 deletions(-)



More information about the gnucash-changes mailing list