[GNC-dev] Stuck: Creating a distribution list

john jralls at ceridwen.us
Mon Aug 15 21:11:43 EDT 2022



> On Aug 15, 2022, at 3:27 AM, Ralf Zerres <ralf.zerres at mail.de> wrote:
> 
> Hey list
> 
>  I got stucked while hacking the new distribution list feature in
> gnucash
> may someone can give me a light, please?
> 
> my latest repro with the code in question is accessible on github
> (https://github.com/rzerres/gnucash/tree/coowner)
> 
> I did summerize the intention of the routines in
> https://github.com/rzerres/gnucash/blob/coowner/doc/property-management.md
> And distribution lists are one peace in the puzzle to predefine
> apportionable shares/percentage values to property units.
> You may see the analogy to billing terms.
> 
> My problem:
> When creating a distribution list assigned to a book
> (GncDistributionList * gncDistribListCreate (QofBook *book) line 284:
> the attributes of the struct are presetted as expected.
> 
> Then in line 289 i need to add an object  (addObj (distriblist).
> The fuction call should  initialize a pointer to a _book_info structure
> (line 105). Analog code is present in gncBillTerm.c and does work as
> expected.
> Now calling line 107: 
> 
>      book_info = qof_book_get_data (qof_instance_get_book(distriblist),
> _GNC_MOD_NAME);
> 
> will not update as expected.  It stays NULL. And i have no clue to
> that.
> 
> Is anybody able to explain why? Again, compairing this to gncBillTerm
> where the book_info (there: bi) is filled in correctly.

Looks like you forgot to call gncDistribListRegister. You probably want to add it to the list in business_core_init() in cashobjects.c.

Regards,
John Ralls



More information about the gnucash-devel mailing list