Import Invoice Entries by Database Trigger

John Ralls jralls at ceridwen.us
Wed Mar 12 19:49:49 EDT 2014


On Mar 12, 2014, at 7:03 AM, Adrian Hodson <no.bicycle.subscriptions at gmail.com> wrote:

> On Wed, 12 Mar 2014 06:51:58 -0700
> John Ralls <jralls at ceridwen.fremont.ca.us> wrote:
> 
>> 
>> On Mar 12, 2014, at 3:47 AM, Adrian Hodson
>> <no.bicycle.subscriptions at gmail.com> wrote:
>> 
>>> Hello,
>>> I am using Partkeepr for inventory and Gnucash on the same Mysql
>>> server instance. 
>>> 
>>> I plan for customers to sign off on an initial invoice from Gnucash.
>>> A Partkeepr Materials List ID will be identical to the Gnucash
>>> Invoice number.
>>> 
>>> I would like to create a database trigger  on Partkeeper that
>>> inserts Materials entries (quantity, price, etc) into the Entries
>>> table in Gnucash using the invoice number (pre-created in Gnucash). 
>>> 
>>> I see the entries in the Gnucash Entries table have guid,date and
>>> date_entered fields as not null. Followed by invoice related fields
>>> i_acct ... i_discount_denom ... , followed by billing related fields
>>> and finally order_guid. 
>>> 
>>> Could this mechanism work from Gnucash point of view? 
>> 
>> No.
>> 
>> None of GnuCash's business logic is embedded in the database, so the
>> only way to write to the database is via one of GnuCash's APIs: C,
>> Scheme, or Python.
>> 
>>> 
>>> If so,  I would like to know how to obtain a new instance of guid
>>> for the records that I insert. Also Which of the Entries table
>>> fields are foreign keys?
>>> 
>>> 
>>> Such a mechanism would be of general benefit to anyone using an
>>> external inventory system.
>> 
>> Which isn't a supported use of GnuCash. You'd be better off with an
>> ERP program. Searching "ERP' on SourceForge will turn up several.
>> 
>> Regards,
>> John Ralls
>> 
> 
> Thanks John.
> Partkeepr is a tremendous inventory program, as efficient and
> unbloated as Gnucash. ERP is overkill for my purposes.
> I realise what I propose is unsupported, however auto inserting Invoice
> entries instead of copy-pasting them seems simple and very useful. I'll
> have a go with the Python API.

OK, but please remember to copy the list on all replies: Use "reply all" or, if your mail client provides it, "reply list".

Invoices are among the more complicated processes in GnuCash and so the most likely to screw up your database if you go outside of the API. Good luck and don't test on your production data!

Regards,
John Ralls





More information about the gnucash-devel mailing list