Submit a payment from somewhere not in the GUI...

Geert Janssens geert.gnucash at kobaltwit.be
Mon Nov 17 12:17:28 EST 2014


On Friday 14 November 2014 08:00:28 Allen S. Rout wrote:
> On 11/13/2014 07:41 PM, John Ralls wrote:
> > On Nov 13, 2014, at 1:15 PM, Allen S. Rout <asr at ufl.edu> wrote:
> > 
> > 
> > 
> > No. You’ll need to script your interaction in Scheme or Python,
> 
> I've been working with the Python APIs for insertion of invoices, and
> modification of customers.  I can't see anything that looks like the
> hooks for payments.  That's why I was asking; I was hoping to write a
> python script for that purpose.

You could use either
Customer.ApplyPayment
or
Invoice.ApplyPayment

The former will assign a payment to the list of all outstanding invoices for that customer on a 
FIFO basis.

The second one will assign a payment to one specific invoice. Depending on the payment 
amount and the invoice amount this will result in
* a fully paid invoice (if both amounts were equal)
* a fully paid invoice with an outstanding pre-payment (if the payment was bigger than the 
invoice)
* a partially paid invoice (if the payment was less than the invoice)

There are some examples in simple_business_create.py. You would have to look at the most 
recent maint branch head in git though for a fully working example. I noticed the files was out 
of date since the 2.6 release. I have pushed some changes to fix this.

Will this help you ?

Geert


More information about the gnucash-devel mailing list