mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix a few typos in python example scripts and align them with the latest api changes
This commit is contained in:
parent
22490a37ab
commit
e59c3e0639
@ -163,10 +163,10 @@ try:
|
|||||||
invoice_entry.SetDateEntered(datetime.datetime.now())
|
invoice_entry.SetDateEntered(datetime.datetime.now())
|
||||||
|
|
||||||
invoice_customer.PostToAccount(a2, datetime.date.today(), datetime.date.today(),
|
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),
|
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),
|
invoice_customer.ApplyPayment(None, a6, GncNumeric(7,100),
|
||||||
GncNumeric(1), datetime.date.today(), "", "")
|
GncNumeric(1), datetime.date.today(), "", "")
|
||||||
|
@ -22,11 +22,12 @@
|
|||||||
# @author Mark Jenkins, ParIT Worker Co-operative <mark@parit.ca>
|
# @author Mark Jenkins, ParIT Worker Co-operative <mark@parit.ca>
|
||||||
|
|
||||||
# Opens a GnuCash book file and adds an invoice to it for a particular
|
# 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
|
# 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
|
# 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:
|
# Syntax:
|
||||||
# gnucash-env python simple_invoice_insert.py \
|
# 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)
|
s = Session(argv[1], is_new=False)
|
||||||
# this seems to make a difference in more complex cases
|
|
||||||
s.save()
|
|
||||||
|
|
||||||
book = s.book
|
book = s.book
|
||||||
root = book.get_root_account()
|
root = book.get_root_account()
|
||||||
commod_table = book.get_table()
|
commod_table = book.get_table()
|
||||||
CAD = commod_table.lookup('CURRENCY', 'CAD')
|
CAD = commod_table.lookup('CURRENCY', 'CAD')
|
||||||
|
|
||||||
my_customer = book.LookupByID(arg[2])
|
my_customer = book.CustomerLookupByID(argv[2])
|
||||||
assert( my_customer != None )
|
assert( my_customer != None )
|
||||||
assert( isinstance(my_customer, Customer) )
|
assert( isinstance(my_customer, Customer) )
|
||||||
|
|
||||||
assets = root.lookup_by_name("Assets")
|
assets = root.lookup_by_name("Assets")
|
||||||
recievables = assets.lookup_by_name("Recievables")
|
receivables = assets.lookup_by_name("Receivables")
|
||||||
income = root.lookup_by_name("Income")
|
income = root.lookup_by_name("Income")
|
||||||
|
|
||||||
invoice = Invoice(book, argv[3], CAD, my_customer )
|
invoice = Invoice(book, argv[3], CAD, my_customer )
|
||||||
@ -114,8 +113,8 @@ invoice_entry.SetQuantity( GncNumeric(1) )
|
|||||||
invoice_entry.SetInvAccount(income)
|
invoice_entry.SetInvAccount(income)
|
||||||
invoice_entry.SetInvPrice(invoice_value)
|
invoice_entry.SetInvPrice(invoice_value)
|
||||||
|
|
||||||
invoice.PostToAccount(recievables, datetime.date.today(), datetime.date.today(),
|
invoice.PostToAccount(receivables, datetime.date.today(), datetime.date.today(),
|
||||||
"", True)
|
"", True, False)
|
||||||
|
|
||||||
s.save()
|
s.save()
|
||||||
s.end()
|
s.end()
|
||||||
|
Loading…
Reference in New Issue
Block a user